1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Saving caret position when using external editor, attempting to restore it on window activation. Fixes #4155

This commit is contained in:
Federico Fissore 2015-11-17 17:27:34 +01:00
parent a2fe70aba4
commit d0bd09c8d3

View File

@ -613,7 +613,11 @@ public class Base {
activeEditor.rebuildRecentSketchesMenu();
if (PreferencesData.getBoolean("editor.external")) {
try {
int previousCaretPosition = activeEditor.getTextArea().getCaretPosition();
activeEditor.getSketch().load(true);
if (previousCaretPosition < activeEditor.getText().length()) {
activeEditor.getTextArea().setCaretPosition(previousCaretPosition);
}
} catch (IOException e) {
// noop
}