We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac3e275 commit 0bcf8b2Copy full SHA for 0bcf8b2
filebrowser.js
@@ -2439,11 +2439,17 @@ function setupEditor() {
2439
// compare current code with new code
2440
// if the code is different, swap it
2441
if (hashCode(selText) !== hashCode(beautifiedText)) {
2442
-
+
2443
+ // get current selection
2444
+ const [startPos, endPos] = cd.getSelection();
2445
2446
// replace selection contents
2447
// with beautified text
2448
cd.deleteCurrentSelection();
2449
cd.insert(beautifiedText);
2450
2451
+ // reselect
2452
+ cd.setSelection(startPos, endPos);
2453
2454
// dispatch type event (simulate typing)
2455
cd.dispatchTypeEvent();
0 commit comments