@thazhemadam/vim-state 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/index.js +12 -0
- package/package.json +1 -1
package/dist/editor/index.js
CHANGED
|
@@ -190,7 +190,11 @@ class VimEditorCore {
|
|
|
190
190
|
/** Move left until the Normal-mode cursor sits on a character, or column 0 for an empty line. */
|
|
191
191
|
clampCursorColumn() {
|
|
192
192
|
while (this.cursor.col > normalMaxColumn(this.currentLine)) {
|
|
193
|
+
const before = { ...this.cursor };
|
|
193
194
|
this.host.sendInputToEditor(ARROW_LEFT);
|
|
195
|
+
if (samePosition(this.cursor, before)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
get cursor() {
|
|
@@ -536,10 +540,18 @@ class VimEditorCore {
|
|
|
536
540
|
/** Move to a zero-based position using host editor cursor primitives. */
|
|
537
541
|
moveCursorToPosition(position) {
|
|
538
542
|
while (this.cursor.line < position.line) {
|
|
543
|
+
const before = { ...this.cursor };
|
|
539
544
|
this.host.sendInputToEditor(ARROW_DOWN);
|
|
545
|
+
if (samePosition(this.cursor, before)) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
540
548
|
}
|
|
541
549
|
while (this.cursor.line > position.line) {
|
|
550
|
+
const before = { ...this.cursor };
|
|
542
551
|
this.host.sendInputToEditor(ARROW_UP);
|
|
552
|
+
if (samePosition(this.cursor, before)) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
543
555
|
}
|
|
544
556
|
this.moveCaretToColumn(position.col);
|
|
545
557
|
}
|