Skip to content

Commit d165d63

Browse files
authored
Merge pull request #3306 from Vishawdeep-Singh/fix/Exiting_Multi-Line_Cursor_Doesnt_Return_to_the_Original_Cursor
Fix : Exiting Multi-Line Cursor Doesn't Return to the Original Cursor
2 parents c7d835e + 1e2e4a4 commit d165d63

File tree

1 file changed

+9
-1
lines changed
  • client/modules/IDE/components/Editor

1 file changed

+9
-1
lines changed

Diff for: client/modules/IDE/components/Editor/index.jsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,15 @@ class Editor extends React.Component {
211211
}
212212
if (e.key === 'Escape') {
213213
e.preventDefault();
214-
this._cm.getInputField().blur();
214+
const selections = this._cm.listSelections();
215+
216+
if (selections.length > 1) {
217+
const firstPos = selections[0].head || selections[0].anchor;
218+
this._cm.setSelection(firstPos);
219+
this._cm.scrollIntoView(firstPos);
220+
} else {
221+
this._cm.getInputField().blur();
222+
}
215223
}
216224
});
217225

0 commit comments

Comments
 (0)