mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-97890 (Mac OSX) Highlight word or filename in rename dialogue, then press right arrow key, cursor jumps one character to right too much
This commit is contained in:
+5
-5
@@ -24,7 +24,6 @@ import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
|
||||
class MoveCaretLeftOrRightHandler extends EditorActionHandler {
|
||||
enum Direction {LEFT, RIGHT}
|
||||
@@ -48,11 +47,12 @@ class MoveCaretLeftOrRightHandler extends EditorActionHandler {
|
||||
else {
|
||||
int start = selectionModel.getSelectionStart();
|
||||
int end = selectionModel.getSelectionEnd();
|
||||
int caretOffset = caretModel.getOffset();
|
||||
|
||||
int leftGuard = start + (myDirection == Direction.LEFT ? 1 : 0);
|
||||
int rightGuard = end - (myDirection == Direction.RIGHT ? 1 : 0);
|
||||
|
||||
if (TextRange.from(leftGuard, rightGuard - leftGuard + 1).contains(caretModel.getOffset())) { // See IDEADEV-36957
|
||||
//int leftGuard = start + (myDirection == Direction.LEFT ? 1 : 0);
|
||||
//int rightGuard = end - (myDirection == Direction.RIGHT ? 1 : 0);
|
||||
//if (TextRange.from(leftGuard, rightGuard - leftGuard + 1).contains(caretModel.getOffset())) { // See IDEADEV-36957
|
||||
if (start <= caretOffset && end >= caretOffset) { // See IDEADEV-36957
|
||||
selectionModel.removeSelection();
|
||||
caretModel.moveToOffset(myDirection == Direction.RIGHT ? end : start);
|
||||
scrollingModel.scrollToCaret(ScrollType.RELATIVE);
|
||||
|
||||
Reference in New Issue
Block a user