mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-154894 [api] ability for disabling scrolling on document changes into Editor
This commit is contained in:
@@ -132,6 +132,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
private static final Key<JComponent> PERMANENT_HEADER = Key.create("PERMANENT_HEADER");
|
||||
public static final Key<Boolean> DO_DOCUMENT_UPDATE_TEST = Key.create("DoDocumentUpdateTest");
|
||||
public static final Key<Boolean> FORCED_SOFT_WRAPS = Key.create("forced.soft.wraps");
|
||||
public static final Key<Boolean> DISABLE_CARET_POSITION_KEEPING = Key.create("editor.disable.caret.position.keeping");
|
||||
private static final boolean HONOR_CAMEL_HUMPS_ON_TRIPLE_CLICK = Boolean.parseBoolean(System.getProperty("idea.honor.camel.humps.on.triple.click"));
|
||||
private static final Key<BufferedImage> BUFFER = Key.create("buffer");
|
||||
private static final Color CURSOR_FOREGROUND_LIGHT = Gray._255;
|
||||
@@ -1894,7 +1895,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
repaintToScreenBottom(0);
|
||||
updateCaretCursor();
|
||||
|
||||
restoreCaretRelativePosition();
|
||||
if (!Boolean.TRUE.equals(getUserData(DISABLE_CARET_POSITION_KEEPING))) {
|
||||
restoreCaretRelativePosition();
|
||||
}
|
||||
}
|
||||
|
||||
private void beforeChangedUpdate(@NotNull DocumentEvent e) {
|
||||
@@ -1962,7 +1965,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
repaintLines(startLine, endLine);
|
||||
}
|
||||
|
||||
if (getCaretModel().getOffset() < e.getOffset() || getCaretModel().getOffset() > e.getOffset() + e.getNewLength()){
|
||||
if (!Boolean.TRUE.equals(getUserData(DISABLE_CARET_POSITION_KEEPING)) &&
|
||||
(getCaretModel().getOffset() < e.getOffset() || getCaretModel().getOffset() > e.getOffset() + e.getNewLength())) {
|
||||
restoreCaretRelativePosition();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user