Skip to content

Commit d0bd09c

Browse files
author
Federico Fissore
committed
Saving caret position when using external editor, attempting to restore it on window activation. Fixes #4155
1 parent a2fe70a commit d0bd09c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/src/processing/app/Base.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,11 @@ protected void handleActivated(Editor whichEditor) {
613613
activeEditor.rebuildRecentSketchesMenu();
614614
if (PreferencesData.getBoolean("editor.external")) {
615615
try {
616+
int previousCaretPosition = activeEditor.getTextArea().getCaretPosition();
616617
activeEditor.getSketch().load(true);
618+
if (previousCaretPosition < activeEditor.getText().length()) {
619+
activeEditor.getTextArea().setCaretPosition(previousCaretPosition);
620+
}
617621
} catch (IOException e) {
618622
// noop
619623
}

0 commit comments

Comments
 (0)