Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable cursor positioning with mouse in normal mode #4405

Open
nicholascannon opened this issue Dec 19, 2019 · 19 comments
Open

Disable cursor positioning with mouse in normal mode #4405

nicholascannon opened this issue Dec 19, 2019 · 19 comments

Comments

@nicholascannon
Copy link

Is your feature request related to a problem? Please describe.
Whenever I want to focus my editor I use the mouse and randomly click inside it. Doing this repositions the cursor. I'd rather it just reactivate the editor and keep the cursor at the line it was at before and then use vim commands to navigate the file. Basically the same behaviour when using the mouse with vim in terminal.

Describe the solution you'd like
Mouse clicks inside the editor (whilst in normal) mode does not change the cursor location.

Describe alternatives you've considered
Using the keyboard shortcut to focus the editor. Not really a fan of the shortcut and I frequently use the mouse when navigating the file explorer within vscode.

Additional context
Selecting text should still work. If you're having trouble understanding the behaviour i'm describing open your terminal and run vim on a text file and use the mouse inside.

@J-Fields
Copy link
Member

Selecting text should still work

Not sure this is really possible with the current VSCode API. The closest we could get, I think, would be using a second cursor for the selection, but then we'd need to ignore this cursor and its selection for most commands and try to counter-act VSCode's operations on it. Frankly, I'm not sure the result would be very satisfying and would add significant complexity to the code base.

@nicholascannon
Copy link
Author

nicholascannon commented Dec 25, 2019

@J-Fields Selecting Selecting text with the mouse isn't really a big deal (not worth it if it will add a lot of complexity with not very good results) as I (and I assume most others) will use visual modes to select text. Mainly the cursor repositioning is important, hopefully this can be done without adding too much complexity to the code base.

@Dieterbe
Copy link

+1 coming from vim, this is very frustrating.
So often in vim I have a cursor where i want to paste, press 'i' for insert mode, copy some text somewhere with my mouse, then press 'p' to paste.

But because of this issue that workflow pattern breaks :(

@jjthiessen
Copy link

Similarly, but different, I don't mind my cursor moving about while in normal mode, but it's really annoying for me when mouse events reposition the cursor while I'm in insert mode. This is because I use primary selection a lot. When middle-click pasting, I don't want to have to click in the exact right place to make it work (the cursor warps before pasting occurs). I don't have the same issue with focusing and raising windows (because focus follows mouse, and I'm using a tiling WM), but I understand you'd have the same problem otherwise (if you use click to focus and you left your editor in insert mode while changing windows).

@Adolf-L
Copy link

Adolf-L commented May 5, 2020

Disable cursor positioning with mouse in normal mode which is a important UX.... we need this feature.

@Pivert
Copy link

Pivert commented Aug 30, 2020

This behaviour is very frustrating, being obliged to super carefully middle click on the line you activated the insert (vim mode) to properly paste.
For the left mouse click, I can cope with it. But for the middle (paste) click, this really breaks the workflow.

@ragvri
Copy link

ragvri commented Sep 23, 2020

I am facing the opposite issue. I don't know why but my cursor position does not update when I click at some other location in normal mode. When I go back to insert mode, the cursor goes back to where it was before click. I do not want this

@junekhan
Copy link

I am facing the opposite issue. I don't know why but my cursor position does not update when I click at some other location in normal mode. When I go back to insert mode, the cursor goes back to where it was before click. I do not want this

Same here. About one week ago before I updated my VSCode and its plugins, everything was fine, the cursor followed my mouse and keyboard consecutively, I've been long used to it. So please, provide us with the option to choose our preferences.

@apolzon
Copy link

apolzon commented Sep 24, 2020

Just chiming in that having the cursor "lie" about its current location after mouse-clicking is incredibly unintuitive. This behavior changed sometime in the last couple weeks as it was working as expectedly before.

What is really weird is that some movement commands will move the cursor in its current location instead of reverting to the previous location -- horizontal movements (hjwb etc) use the previous location, but if you click and then use vertical movement (jk), the cursor will behave as expected, and update its "real" location so that you can then use horizontal movement.

I would guess my explanation is not very clear, if a video is needed to better illustrate what is happening please let us know.

@pwnz22
Copy link

pwnz22 commented Sep 25, 2020

I am facing the opposite issue. I don't know why but my cursor position does not update when I click at some other location in normal mode. When I go back to insert mode, the cursor goes back to where it was before click. I do not want this

Also facing this issue. Is there any option how to revert this!?

@SergeiStruk
Copy link

SergeiStruk commented Sep 25, 2020

Also facing this issue. Is there any option how to revert this!?

As a temporary solution downgrade to 1.16.0 helped me: https://www.vsixhub.com/vsix/38553/. You can install it using this command: code --install-extension vim-1.16.0_vsixhub.com.vsix. Also I disabled extensions auto updating.

@salolivares
Copy link

salolivares commented Sep 25, 2020

An alternative is to downgrade VSVim in VSCode itself: Extensions -> Vim -> Settings -> Install Another Version
1

@xuchen
Copy link

xuchen commented Sep 25, 2020

the opposite happened to me in version 1.17.0 released 2 days ago (9/23/2020), which also broke my normal usage pattern. Downgrading to 1.16.0 solved the problem, I have vim cursor following mouse back.

To summarize, I think 1.16.0 has roughly (vim cursor follows mouse):

set mouse=a     " Enable mouse usage (all modes) in terminals

1.17.0 has roughly (vim cursor does not follow mouse):

set mouse=v     " Visual mode

It would be nice to have this as a "mouse option" in Settings. Once downgrading to 1.16.0, to prevent auto upgrade, I have to disalbe auto upgrade for all extensions, which is not a long-term solution.

@berknam
Copy link
Contributor

berknam commented Sep 26, 2020

This behaviour is very frustrating, being obliged to super carefully middle click on the line you activated the insert (vim mode) to properly paste.
For the left mouse click, I can cope with it. But for the middle (paste) click, this really breaks the workflow.

@Pivert
This is a different issue and it's not related to this extension. It's an issue in vscode. Check the issue #5065 to better understand it. Maybe you should try to open a feature request for that on vscode.

As for the rest of the people having issues after version 1.17.0 there is now a new version 1.17.1 that might fix some of the issues you're facing. Try updating to that one and see if it works now.

@johns1342
Copy link

I am facing the opposite issue. I don't know why but my cursor position does not update when I click at some other location in normal mode. When I go back to insert mode, the cursor goes back to where it was before click. I do not want this

This appears to be fixed in 1.17.1 (see issue #5212), released today. It seems like most of us found our way here trying to figure out how to resolve #5212.

@Dieterbe
Copy link

strangely the behavior requested in #5212 is not how vim works at all... the behavior asked for here, is, however.

@junekhan
Copy link

junekhan commented Oct 8, 2020

Hi, I guess I have a new problem now with 1.17.1, when I navigate back or forward, the cursor seemingly moves as I go, however, once I start moving the cursor, it won't start from where the cursor is but the point I started navigating.

@apolzon
Copy link

apolzon commented Oct 8, 2020

I’ve also noticed some weird behavior when using change-word and change-to-letter commands in the latest version where a seemingly random character will be removed several words away from where my cursor is. I haven’t been able to nail down exactly what scenarios cause it but if I can figure that out I’ll be happy to log a more detailed report.

None of these problems were present prior to 1.17 - I have to wonder what issue in the vim plugin needed fixing that has resulted in these repeated regressions against expected behavior.

@berknam
Copy link
Contributor

berknam commented Oct 8, 2020

@junekhan

Hi, I guess I have a new problem now with 1.17.1, when I navigate back or forward, the cursor seemingly moves as I go, however, once I start moving the cursor, it won't start from where the cursor is but the point I started navigating.

@apolzon

I’ve also noticed some weird behavior when using change-word and change-to-letter commands in the latest version where a seemingly random character will be removed several words away from where my cursor is. I haven’t been able to nail down exactly what scenarios cause it but if I can figure that out I’ll be happy to log a more detailed report.

None of these problems were present prior to 1.17 - I have to wonder what issue in the vim plugin needed fixing that has resulted in these repeated regressions against expected behavior.

Both your situations are probably related to #5221 and might be fixed with PR #5250. If any of you can test that PR please post your feedback on that PR thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests