question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong cursor position after using same file in two panels

See original GitHub issue

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

It’s a bug report

What happened:

  1. Open same file in two panels (i.e. side by side) with vim mode enabled
  2. At one buffer (A) jump to line 10
  3. At second buffer (B) click at line 20
  4. Get back to buffer A (at this point we are at line 10) and hit j (for vim “down by line” move)
  5. I am taken to line 21

What did you expect to happen:

At point 5 I should be taken to line 11.

How to reproduce it (as minimally and precisely as possible):

I’ve described it at the What happened section. Here is a video.

video

Environment:

  • Extension (VsCodeVim) version: 0.12.0
  • VSCode version: 1.23.1
  • OS version: 10.13.2 (17C88)

Update

Seems like reverting one change helped. I’ve created a PR.

For v0.14+ fix please see the comment

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:38
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
jpooncommented, Jun 27, 2018

Thanks @chibicode. For folks following this issue, please thumbs upstream vscode issue!

1reaction
lukaszbcommented, Sep 8, 2018

Seems this would be fixed in near future but it still breaks at 0.14. Here is a diff one can use to fix the issue (but note that this will bring back another issue with undo).

diff --git out/src/editorIdentity.js out/src/editorIdentity.js
index 2635d31..414b434 100644
--- out/src/editorIdentity.js
+++ out/src/editorIdentity.js
@@ -1,20 +1,26 @@
 "use strict";
+const vscode = require("vscode");
+
 Object.defineProperty(exports, "__esModule", { value: true });
 class EditorIdentity {
     constructor(textEditor) {
         this._fileName = (textEditor && textEditor.document && textEditor.document.fileName) || '';
+        this._viewColumn = (textEditor && textEditor.viewColumn) || vscode.ViewColumn.One;
     }
     get fileName() {
         return this._fileName;
     }
+    get viewColumn() {
+      return this._viewColumn;
+    }
     hasSameBuffer(identity) {
         return this.fileName === identity.fileName;
     }
     isEqual(other) {
-        return this.fileName === other.fileName;
+        return this.fileName === other.fileName && this.viewColumn === other.viewColumn;
     }
     toString() {
-        return this.fileName;
+        return this.fileName + this.viewColumn;
     }
 }
 exports.EditorIdentity = EditorIdentity;

you can apply it with patch -p0 < FILENAME at ~/.vscode/extensions/vscodevim.vim-0.14.0/


Updated patch for 0.16:

diff --git out/src/editorIdentity.js out/src/editorIdentity.js
index 2635d31..414b434 100644
--- out/src/editorIdentity.js
+++ out/src/editorIdentity.js
@@ -1,20 +1,26 @@
 "use strict";
+const vscode = require("vscode");
+
 Object.defineProperty(exports, "__esModule", { value: true });
 class EditorIdentity {
     constructor(textEditor) {
         this._fileName = (textEditor && textEditor.document && textEditor.document.fileName) || '';
+        this._viewColumn = (textEditor && textEditor.viewColumn) || vscode.ViewColumn.One;
     }
     get fileName() {
         return this._fileName;
     }
+    get viewColumn() {
+      return this._viewColumn;
+    }
     isEqual(other) {
-        return this.fileName === other.fileName;
+        return this.fileName === other.fileName && this.viewColumn === other.viewColumn;
     }
     toString() {
-        return this.fileName;
+        return this.fileName + this.viewColumn;
     }
 }
 exports.EditorIdentity = EditorIdentity;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vim cursor highlights wrong position - Unix Stack Exchange
While I was editing a file, suddenly the cursor marker moved one or more spaces to the right while the cursor actions still...
Read more >
Mouse cursor on screen shifted up and to the left - Dell
The cursor shows up about one cursor width to the left and above the location where the mouse actuates. The behavior is consistent...
Read more >
vmmouse cursor position doesn't match screen coordinates
Steps to Reproduce: 1. update a vmware image using vmmouse driver to at least 22-Feb-08 2.Observe disconnected cursor position 3.
Read more >
Mouse cursor offset on external monitors - Citrix Discussions
I have one user that when he launches a Citrix application the mouse cursor is offset. ... He is running a laptop with...
Read more >
Open Panel (files / folders) and Insert a File at Cursor Position
C-x i has filename completion. Which means you can use the exact same keystrokes to insert a file as to visit it with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found