From 06dd36b2d5ec36d08eba2ad57b0bc63dfc1cf4b4 Mon Sep 17 00:00:00 2001 From: Vishawdeep Singh Date: Tue, 24 Dec 2024 15:18:57 +0530 Subject: [PATCH 1/2] fix Exiting Multi-Line Cursor Doesnt Return to the Original Cursor --- client/modules/IDE/components/Editor/index.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/components/Editor/index.jsx b/client/modules/IDE/components/Editor/index.jsx index 8393116308..98581ab950 100644 --- a/client/modules/IDE/components/Editor/index.jsx +++ b/client/modules/IDE/components/Editor/index.jsx @@ -210,8 +210,16 @@ class Editor extends React.Component { this.showHint(_cm); } if (e.key === 'Escape') { + console.log(this._cm); e.preventDefault(); - this._cm.getInputField().blur(); + const selections = this._cm.listSelections(); + if (selections.length > 1) { + const firstPos = selections[0].head || selections[0].anchor; + this._cm.setSelection(firstPos); + this._cm.scrollIntoView(firstPos); + } else { + this._cm.getInputField().blur(); + } } }); From 1e2e4a49a2b08870f95623a3ce15cd5e3977b328 Mon Sep 17 00:00:00 2001 From: raclim Date: Thu, 6 Feb 2025 19:19:14 -0500 Subject: [PATCH 2/2] remove extra console log --- client/modules/IDE/components/Editor/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/IDE/components/Editor/index.jsx b/client/modules/IDE/components/Editor/index.jsx index 98581ab950..4bcd396673 100644 --- a/client/modules/IDE/components/Editor/index.jsx +++ b/client/modules/IDE/components/Editor/index.jsx @@ -210,9 +210,9 @@ class Editor extends React.Component { this.showHint(_cm); } if (e.key === 'Escape') { - console.log(this._cm); e.preventDefault(); const selections = this._cm.listSelections(); + if (selections.length > 1) { const firstPos = selections[0].head || selections[0].anchor; this._cm.setSelection(firstPos);