1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-07-24 20:59:02 +02:00

Fix right motion for non-ascii character

This commit is contained in:
Alex Plate 2019-04-10 18:44:36 +03:00
parent b7d82cddbc
commit f6e7019b51
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -1240,9 +1240,12 @@ public class MotionGroup {
public int moveCaretHorizontalWrap(@NotNull Editor editor, @NotNull Caret caret, int count) {
// FIX - allows cursor over newlines
int oldOffset = caret.getOffset();
int offset = Math.min(Math.max(0, caret.getOffset() + count), EditorHelper.getFileSize(editor));
if (offset == oldOffset) {
VisualPosition visualPosition = caret.getVisualPosition();
int newOffset = EditorHelper
.visualPositionToOffset(editor, new VisualPosition(visualPosition.line, visualPosition.column + count));
int offset = Math.min(Math.max(0, newOffset), EditorHelper.getFileSize(editor));
if (offset == caret.getOffset()) {
return -1;
}
else {
@ -1251,10 +1254,12 @@ public class MotionGroup {
}
public int moveCaretHorizontal(@NotNull Editor editor, @NotNull Caret caret, int count, boolean allowPastEnd) {
int oldOffset = caret.getOffset();
int offset = EditorHelper.normalizeOffset(editor, caret.getLogicalPosition().line, oldOffset + count, allowPastEnd);
VisualPosition visualPosition = caret.getVisualPosition();
int newOffset = EditorHelper
.visualPositionToOffset(editor, new VisualPosition(visualPosition.line, visualPosition.column + count));
int offset = EditorHelper.normalizeOffset(editor, caret.getLogicalPosition().line, newOffset, allowPastEnd);
if (offset == oldOffset) {
if (offset == caret.getOffset()) {
return -1;
}
else {