mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
preserve caret position on mode switch
This commit is contained in:
+4
@@ -275,10 +275,14 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
|
||||
myMode = mode;
|
||||
|
||||
Editor oldEditor = (myInputComponent != null) ? myInputComponent.getInputEditor().getEditor() : null;
|
||||
|
||||
myInputComponent = createInputComponent(mode, text);
|
||||
myMainPanel.removeAll();
|
||||
myInputComponent.addComponent(myMainPanel, myResultPanel);
|
||||
|
||||
XDebuggerEditorBase.copyCaretPosition(oldEditor, myInputComponent.getInputEditor().getEditor());
|
||||
|
||||
mySwitchModeAction.putValue(Action.NAME, getSwitchButtonText(mode));
|
||||
getInputEditor().requestFocusInEditor();
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ public abstract class XDebuggerEditorBase implements Expandable {
|
||||
DebuggerUIUtil.getActionShortcutText(IdeActions.ACTION_PREVIOUS_OCCURENCE));
|
||||
}
|
||||
|
||||
private static void copyCaretPosition(@Nullable Editor source, @Nullable Editor destination) {
|
||||
public static void copyCaretPosition(@Nullable Editor source, @Nullable Editor destination) {
|
||||
if (source != null && destination != null) {
|
||||
destination.getCaretModel().moveToOffset(source.getCaretModel().getOffset());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user