tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

Mouse commands doesn't work

Open freitass opened this issue 13 years ago • 40 comments

Whenever I click on the tagbar window vim enters in visual mode and starts selecting everything on the window that was on focus before, from the original position of the cursor to the current mouse position (and the selection changes as if I was pressing the left mouse button).

Notes:

  • NERDTree plugin is also installed and the mouse commands work just fine there.
  • I'm using mouse=a

freitass avatar May 12 '11 20:05 freitass

Sounds like you're using the right mouse button since that's its default behaviour (see :h 'mousemodel'). Tagbar only uses the left mouse button, so it should work if you're using that. If you are using the left mouse button there must be something strange going on with your configuration.

majutsushi avatar May 13 '11 03:05 majutsushi

I've just checked here. I am using the left click and mousemodel=extend .

Rephrasing what I said before, when I click the tagbar window the focus doesn't change, vim behaves like if I had clicked and dragged from the cursor position to the position where I clicked in the tagbar window, selecting the correspondent text on the focused window. Moreover, the keyboard commands work for tagbar.

I have installed the tagbar as well as the other plugins through pathogen.

freitass avatar May 16 '11 13:05 freitass

That's odd. Are you using Vim in a terminal or a GUI version? What operating system are you using? It sounds like something is interfering with the mouse so that its events don't get passed to Vim. Can you use the mouse to select windows when you don't open Tagbar?

majutsushi avatar May 18 '11 03:05 majutsushi

I'm using Vim in a terminal of the Gentoo Linux operating system. Even when Tagbar is opened I can use the mouse normally, it just don't work with Tagbar's window. I want to compare the way Tagbar and NERDTree handle its windows, as they should work like each other.

freitass avatar May 18 '11 12:05 freitass

Sorry... wrong button.

freitass avatar May 18 '11 12:05 freitass

I don't have much experience coding vim scripts but in NERDTree they have the following line nnoremap <silent> <buffer> <2-leftmouse> :call <SID>activateNode(0)<cr> whilst I have not found any reference to mouse in the source code of Tagbar. The <SID>activateNode(force) function identifies the current line and performs the appropriate action.

freitass avatar May 18 '11 15:05 freitass

There are two mouse mappings in Tagbar, the second and fourth mappings in the s:MapKeys() function, and they have been there for quite some time. Could you try testing it with Gvim to see if there's any difference in behaviour? If yes then there must be something going on with your terminal.

majutsushi avatar May 22 '11 04:05 majutsushi

Yeah... it works with gvim. Just for the record, the terminal I'm using is mrxvt with bash and I will try to make tagbar work there. Thanks (I'll leave this opened in case you still want to insert a last comment ;-) )

freitass avatar May 23 '11 13:05 freitass

I just tried it with mrxvt, and it worked for me there. So I'm afraid I can't really help you with the problem. By the way, if you need a terminal that you can use with CJK characters I recommend rxvt-unicode.

majutsushi avatar May 25 '11 01:05 majutsushi

Maybe we are going off topic now, but I just use mrxvt because it is lightweight and has tabs. I think I'll try another version of mrxvt (I'm not in my work machine so I can't tell which version I have installed) maybe changing some portage flags. I'll keep you updated on my results.

freitass avatar May 25 '11 02:05 freitass

Sorry for taking so long to report. Unfortunately mrxvt has only one version available at gentoo portage and I have ended looking for other versions of terminal emulator but none of them pleased me as much as mrxvt. So, as I don't intend to work on a machine without graphical interface, I decided that I have nothing to lose adopting gvim (in which mouse commands work just fine here) as text editor/IDE. Sorry I coudn't contribute to yours and/or mrxvt's project and thank you for your attention.

freitass avatar May 30 '11 18:05 freitass

No worries, just let me know if you do find something :)

majutsushi avatar May 31 '11 07:05 majutsushi

Just chiming in to say I can't reproduce this on Vim 7.2, Mac, console, with :set mouse=a. Same with MacVim 7.3.

rstacruz avatar Aug 28 '11 14:08 rstacruz

I think I'll close this for now, then. Feel free to reopen if it crops up again!

majutsushi avatar Sep 03 '11 06:09 majutsushi

I'm also experiencing this issue on Vim 7.3 + rxvt-unicode 9.15 (both from debian repositories). I'm using current master(4d925ca3246aaf63d131941dcaac28a90ffb2b4d).

spacepluk avatar Feb 13 '12 14:02 spacepluk

I'm also using Vim and rxvt-unicode from the current Debian unstable, and it works fine for me. Are you sure you're not using the right mouse button and that you haven't changed anything mouse-related in your Vim or urxvt config? I'm not sure this is actually a Tagbar issue.

majutsushi avatar Feb 14 '12 05:02 majutsushi

Some things that you may want to check:

  • Are you using the current Vim version from Debian Unstable? There was a patch not too long ago that had to do with mouse handling and urxvt, so that could have something to do with it.
  • Is your $TERM set to a valid urxvt-value like rxvt-unicode and not to something incorrect like xterm?
  • You should also have a look at :h 'ttymouse' to see if the setting there make any difference.

majutsushi avatar Feb 15 '12 12:02 majutsushi

thanks majutsushi, setting ttymouse did the trick :)

spacepluk avatar Mar 17 '12 14:03 spacepluk

Hi, I experience this issue too. I'm just using gnome-terminal under Ubuntu. I had this issue both with and without tmux my $TERM being set to screen and xterm respectively in those situations.

Setting ttymouse to urxvt solved the issue in my non-tmux setup but causes tmux a world of pain. How should I fix it in my tmux environment?

EDIT: My tmux/vim works fine with ttym=xterm for selecting different vim windows including NERDtree, just not tagbar

simonjbeaumont avatar Jan 28 '13 12:01 simonjbeaumont

This is really weird, I have not been able to reproduce this with any setup mentioned here. Are you sure that Tagbar behaves differently? I can't think of any reason why it would do that ... Does anything change for you if you comment out the mouse button mappings in the s:MapKeys() function? The only other thing I can think of that may or may not have an influence in tmux is its xterm-keys option.

majutsushi avatar Feb 06 '13 09:02 majutsushi

Same bug there with terminator on Viperr Linux (Fedora respin). I tried ttymouse + TERM changes... nothing to do - the problem persists. Using Xterm is ok

metal3d avatar Dec 10 '14 16:12 metal3d

Have you tried setting ttymouse to sgr? And is it possible that the terminal column you're trying to click on is larger than 223? I tried it in gnome-terminal (which uses the same library as terminator) and setting ttymouse as above made clicking beyond column 223 work for me, while setting it to xterm made it not recognize clicks beyond that column at all.

majutsushi avatar Dec 13 '14 04:12 majutsushi

Hi, I can confirm this bug on Arch, Vim 8.0, rxvt-unicode. Strangely, it began to appear only after some update (to Vim or Tagbar) cause a year ago it didn't happen. NERDtree works fine for me in all the terminals, and Tagbar works fine as well in Gvim, or in Xfce terminal. The problem is just with Tagbar, just in rxvt-unicode. Setting ttymouse to urxvt solves it on urxvt, and does not harm in other terminals, so that is what I'm using now.

blochl avatar Nov 04 '16 17:11 blochl

I'm on cygwin, using vim 8.0, $TERM=xterm-256color. I encountered the problem when I changed my text size from 11pt to 10pt font. Returning to 11pt font fixed the issue.

kettro avatar Jul 19 '17 19:07 kettro

Changing my text size to >=11pt also fixed the issue for me. Ubuntu 16.04 Vim 7.4

stephenafamo avatar Sep 14 '17 15:09 stephenafamo

Same problem here with

  • Ubuntu 17.10.
  • QTerminal.
  • export TERM="xterm-256color".
  • mouse=a
  • Tried all ttymouse settings within vim.
  • Only thing that works for me is font 10pt or more (which is far too big for me)

feltech avatar Jan 19 '18 22:01 feltech

Having same problem on

  • OSX 10.14
  • iTerm2 Build 3.1.5
  • VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 16 2018 11:20:51) with mouse options:
    • +mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +mouse +mouse_dec -mouse_gpm -mouse_jsbterm
  • tmux 2.8

Migrating from Taglist (which mouse left-click + scrolling works) to Tagbar and found that my mouse does not work on the Tagbar window.

Found that mouse does work in a straight terminal, but does not work in a tmux session. Other plugins work with mouse properly in tmux session, but not Tagbar.

dpruessner avatar Nov 16 '18 18:11 dpruessner

Having same problem on

  • OSX 10.14

  • iTerm2 Build 3.1.5

  • VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 16 2018 11:20:51) with mouse options:

    • +mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +mouse +mouse_dec -mouse_gpm -mouse_jsbterm
  • tmux 2.8

Migrating from Taglist (which mouse left-click + scrolling works) to Tagbar and found that my mouse does not work on the Tagbar window.

Found that mouse does work in a straight terminal, but does not work in a tmux session. Other plugins work with mouse properly in tmux session, but not Tagbar.

I also have the same issue on jupyterlab terminal

open-trade avatar Oct 23 '19 07:10 open-trade

I'm re-opening this issue because it is apparent from comments that something is still amiss. That being said I can't actually reproduce it myself. The only place I ever use vim not inside tmux is inside Firefox. I don't have any trouble with the mouse in tagbar, but I'm also using Neovim, so I suspect this is a vim configuration issue.

Can those of you who have this problem try to narrow down what the common factor is between you?

alerque avatar Oct 23 '19 07:10 alerque

Using MINGW64 terminal simulator from Git for windows, When the the font size is 9, the mouse wont work inside tagbar. ( Tmux 2.1 and vim 8.1 Included patches: 1-2237

Change the font size >= 12 seems work.

dzhang-b avatar Nov 06 '19 01:11 dzhang-b

Thanks for helping narrow this down @dzhang-b. I would suggest that you are probably looking at a bug in your terminal emulation rather than in Tagbar though. If mouse signals working or not working change at different font sizes it sounds like the terminal itself is broken.

Out of curiosity you say the mouse works elsewhere in vim at the same time?

alerque avatar Nov 06 '19 04:11 alerque

@alerque Yes. Both vim 7.4 and 8.1 have no problem to handle the mouse input. Sometimes when I try to click the tagbar, whole vim freezes that I have to terminate the whole tmux panel. It is not a tmux issue. It has to do with vim, tagbar and terminal emulator interaction somehow.

dzhang-b avatar Nov 06 '19 18:11 dzhang-b

I'd be happy to help review and merge a PR that fixes whatever this elusive issue is, but I cannot reproduce it and I do not have anything even resembling some of the setups described (no Win-10→WSL→Debian for example) so I am unable to reproduce.

If somebody that actually has this problem figures out how to fix it, please feel free to open a PR. It would be welcomed.

alerque avatar Apr 23 '20 08:04 alerque

I have the same issue with ubuntu and archlinux,When using Konsole terminal open vim.If extended the terminal width,the issue will happen.When using Xterm or Terimte terminal open vim in tmux.It seems to happen.In other words,If issue happened,Reducing terminal width will work.

yaocz avatar Aug 07 '20 14:08 yaocz

@yaocz Interesting information, thanks for reporting. Is there a specific terminal size in columns after which you see the bug? Is it only after resize or if the size is set before opening VIM too? Does it go away if you resize a window to be smaller after seeing the problem?

alerque avatar Aug 07 '20 17:08 alerque

@alerque Yes,I always opened the vim or vim in tmux with tagbar windows when resizing terminal width in real time.Indeed,the problem have a boundary of terminal size in columns.If i maximized terminal windows,It immediately happen in my bigger monitor.When i used another small monitor doesn't happen,Then i try to cancel maximize and intentionally extend width.As expected,It happened. Of course,Only g:tagbar_position='right' will happen the issue.And g:tagbar_width size is also affect that maximize windows doesn't happen the issue in my bigger monitor when the size is great than default size.

yaocz avatar Aug 08 '20 07:08 yaocz

@yaocz I can confirm the behavior and it only happens for g:tagbar_position='right' and has to do with terminal column sizes.

Piping avatar Aug 17 '20 18:08 Piping

I can reproduce this issue on my Pop OS 22.04 system. Thanks to their auto-tiling, it made sense that the issue is not just about terminal size, but also about the tag length. Here are my observations:

  1. Write a huge function whose tag declaration does not fit the terminal size. (maybe just resize the terminal, or enter a split mode if you are on Mac/Linux - if you are using WSL, please use Windows Terminal and split the terminal).
  2. That means when you click on the tag when the bar appears on the right, and if the length of the tag declaration exceeds the terminal size, and if it has to take >1 lines to be listed on the bottom -> then it waits for the user to hit enter in order to scroll further (up/down).

Now do the same thing, but with a file having all functions where declarations can be accommodated in the terminal size you have, this problem will not be there.

I'm thinking of a solution but will have to take a look at the source code. Please let me know if anyone faces any issues in reproducing this.

krshrimali avatar May 28 '22 16:05 krshrimali