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

[RDY] Fix visual selection after left click on tabline #2383

Merged
merged 3 commits into from Apr 28, 2015

Conversation

mhinz
Copy link
Member

@mhinz mhinz commented Apr 9, 2015

After left clicking on a tab in the tabline, the in_tab_line variable wasn't
set to false and every following mouse action assumed still being on the
tabline which messed up visual selection etc.

References #2382.

@ghost ghost changed the title Fix visual selection after left click on tabline [RFC] Fix visual selection after left click on tabline Apr 9, 2015
@marvim marvim added the RFC label Apr 9, 2015
@mhinz mhinz force-pushed the fix-left-click branch 4 times, most recently from 21f53a8 to dead852 Compare April 12, 2015 15:16
@tarruda
Copy link
Member

tarruda commented Apr 12, 2015

LGTM, only need to add a functional test(which should be easy, have a look at some tests in mouse_spec.lua)

@splinterofchaos
Copy link

LGTM, though I'm not fully familiar with do_mouse. I compared this code against vanilla vim and it looks like the same bug should exist there, but I could not get the mouse to work for some reason. Would you consider sending a patch upstream?

@mhinz
Copy link
Member Author

mhinz commented Apr 13, 2015

Added an UI test.

I'll investigate why the same bug doesn't happen with Vim.

@mhinz mhinz force-pushed the fix-left-click branch 2 times, most recently from 8cc9a00 to 254950d Compare April 13, 2015 01:29
@mhinz
Copy link
Member Author

mhinz commented Apr 13, 2015

So.. now there are 2 new tests.

The first just checks if left clicking on a tab in the tabline switches to that tabpage.

The second checks if visual selection is still working after a tab in the tabline was left clicked.. and currently that test fails, even after the one-line fix. Instead it switches the places of the tabs which is the actual bug. It works if I try it manually though..

I'll dig deeper.

@tarruda
Copy link
Member

tarruda commented Apr 13, 2015

@mhinz a little tip: You can attach a pynvim GUI to one of the tests with a Screen.debug() statement. This allows you to see and interact with the screen being tested. You need a pygtk3 environment which you can install in pyenv with this script(or install dependencies manually using the system package manager)

@unphased
Copy link

So I ran into this bug and i'm pretty happy that there is a fix. Any chance the PR can get merged? Maybe the PR just needs a little merging to get the CI to pass

@mhinz
Copy link
Member Author

mhinz commented Apr 17, 2015

The fix (mhinz@a1543e2) is working, but the tests don't act as if a user would click around manually. The test itself should be also correct, but something else has to changed yet.

Any pointers are welcome.

@splinterofchaos
Copy link

@mhinz Might the test need a <LeftRelease> somewhere to prevent the code from thinking the cursor had been dragged from the tab line?

@mhinz
Copy link
Member Author

mhinz commented Apr 18, 2015

@splinterofchaos Uhm.. thank you!

@unphased
Copy link

Woo! i would love to see this fixed in neovim

@splinterofchaos
Copy link

Looks like the tests are still failing for the same reason. I'm not familiar with the mouse handling code, nor <LeftMoust> events, but are we sure the tests are correct? If so, is this possibly a bug in the input handling?

@mhinz
Copy link
Member Author

mhinz commented Apr 18, 2015

Hmm, inserting the <LeftRelease> like in the latest commit, makes all tests pass for me locally.

Actually it fails because for another reason now.. before the <LeftRelease> the tabs would end up switched. Now they're in order but the highlight groups are mixed up, as if the wrong tab is focused (the first instead of the second one).

@mhinz mhinz force-pushed the fix-left-click branch 6 times, most recently from a5e9495 to 5be80b9 Compare April 25, 2015 19:39
@mhinz mhinz changed the title [RFC] Fix visual selection after left click on tabline [RDY] Fix visual selection after left click on tabline Apr 25, 2015
@mhinz
Copy link
Member Author

mhinz commented Apr 25, 2015

Should be working now.

@marvim marvim added RDY and removed RFC labels Apr 25, 2015
@splinterofchaos
Copy link

LGTM 👍

@justinmk justinmk added the bug issues reporting wrong behavior label Apr 26, 2015
@mhinz
Copy link
Member Author

mhinz commented Apr 28, 2015

Can this be merged?

After left clicking on a tab in the tabline, the "in_tab_line" variable wasn't
set to 'false' and every following mouse action assumed still being on the
tabline which messed up visual selection etc.
justinmk added a commit that referenced this pull request Apr 28, 2015
Fix visual selection after left click on tabline
@justinmk justinmk merged commit 7315b9d into neovim:master Apr 28, 2015
@justinmk justinmk removed the RDY label Apr 28, 2015
@mhinz mhinz deleted the fix-left-click branch November 11, 2015 16:20
@thor85
Copy link

thor85 commented Jan 23, 2018

I have the same issue with NVIM v0.2.2
I use airline and show buffers in tabline. Whenever I change to a different buffer by clicking the tabline I can no longer select anything with the mouse.

@mhinz
Copy link
Member Author

mhinz commented Jan 23, 2018

@thor85 Can you reproduce it with nvim -u NORC +'tabnew foo | tabnew bar | set mouse=a'?

@thor85
Copy link

thor85 commented Jan 24, 2018

Yea have the same problem then. If I hold down and move the mouse I'm just moving the tabs around.

@mhinz
Copy link
Member Author

mhinz commented Jan 24, 2018

If I hold down and move the mouse I'm just moving the tabs around.

Okay, that's expected behaviour. But afterwards you can't click anything in the tabline anymore, right?

@thor85
Copy link

thor85 commented Jan 24, 2018

No I mean if I click and hold to select some text, it will not select text, but move the tab around.

So when I first open nvim I can select text fine with the mouse. If I change tab with :tabn I can still select text. If I change tab with a mouse click, I cannot select text anymore. Clicking the mouse anywhere just seems like it clicks the tab bar. Have not found any way to reset it except exiting nvim and start over again.

@mhinz
Copy link
Member Author

mhinz commented Jan 24, 2018

Do you use an actual mouse or an trackpad? Do you use tmux?

I tested around a bit and I can reproduce a similar issue when "tapping" a tab in the tabline and then trying to select something. When I use a "full left-click" by pressing the trackpad all the way to the buttom (until it clicks), everything works as expected.

We currently believe that it's a bug in the terminal/tmux, because trackpad tapping and clicking should be handled exactly the same, but it feels as if with tapping there's no proper release. Then Nvim thinks you're still dragging in the tabline.

I can reproduce it with Terminal.app and tmux, but not without tmux. I can't reproduce it with iTerm2 at all.

@thor85
Copy link

thor85 commented Jan 25, 2018

I use an actual mouse. I do use tmux, but I tried without tmux now and got the same problem. I usually use urxvt, but tried gnome terminal and got the same.

However, this is not running directly on my pc. I use a windows laptop to connect with HP RGS to the linux server and run from there, so maybe that could be why the mouse acts weird. I don't have a linux pc available to test right now.

@mhinz
Copy link
Member Author

mhinz commented Jan 26, 2018

@thor85 I'm not sure how to help you right now. I think it would be best if you'd open a new issue and describe the issue again with as many details about your environment as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants