[vim/vim] [Wayland] [mouse] Vim won't start with certain emulators (#4596)

37 views
Skip to first unread message

Keith Bowes

unread,
Jun 26, 2019, 2:48:42 PM6/26/19
to vim/vim, Subscribed

Describe the bug
In alacritty (under both X and Wayland) and wterm at least, it won't start. It seems to occur under these conditions:

  1. Mouse support is enabled (+mouse)
  2. The mouse option contains n (also the situation with set mouse=a, of course)
  3. The ttymouse option is blank.
    [Also, if you've already started Vim without a ttymouse value and set :set mouse=a while it's running, it'll just hang there, unresponsive to mouse or keyboard]

Not only will it not start, but Ctrl-C won't terminate it.

Currently, I'm working around these mouse woes in my vimrc file:

" Allow positioning the cursor and selecting text with a mouse, when possible
if has("mouse")
  " No special mouse support under most conditions
  set mouse=
  if has("eval")
    " Allow Vim to start even if ttymouse isn't set
    if &ttymouse == ""
      set ttymouse=xterm2
    endif
    if &ttymouse == "xterm2"
      set mouse=nv
    else
      " Enable all mouse functions.  Copy-and-paste may require calling external clipboard tools (e.g. xclip).
      set mouse=a
    endif
  endif

However, I'd be willing to try to fix the code in Vim itself, to negate the need for special vimrc-file code. I see a couple solutions, but am not sure which one would be the best:

  1. If mouse support is enabled and ttymouse isn't set (either explicitly in the vimrc or guessed by Vim itself), gracefully exit and tell the user to manually set ttymouse.
  2. Try to figure out what exactly blocks Vim in the first place, and make it try to continue, even if mouse support isn't going to work properly.

To Reproduce
Didn't I describe that above? I've also been able to get this to work (so to speak) in other terminal emulators:

  1. If your terminal emulator's $TERM contains xterm (like gnome-terminal and konsole for some reason do), change $TERM to something not containing xterm (e.g. export TERM=rxvt-unicode-256color).
  2. Start Vim vim --clean.
  3. Type :set ttymouse=.
  4. Type :set mouse=a.
  5. Watch it to become unresponsive.

Expected behavior
I expect it to start/be responsive.

Screenshots
Screenshot of issue

Environment (please complete the following information):

  • Vim version: 8.1.1048
  • OS: Mageia 7.0 RC
  • Terminal: Alacritty, wterm, and perhaps others for which Vim can't guess a ttymouse value


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Nikita Ilyushkin

unread,
May 11, 2020, 8:16:40 PM5/11/20
to vim/vim, Subscribed

Get the same problem with alacritty on Arch (alacritty/alacritty#3694), where .vimrc has:

if has('mouse')
  if &term =~ 'xterm'
    set mouse=a
  else
    set mouse=nvi
  endif
endif

vim version 8.2.0510-2
And I'm not the first one: alacritty/alacritty#2931
Could please anyone look into this?


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Keith Bowes

unread,
Jul 5, 2020, 12:59:01 PM7/5/20
to vim/vim, Subscribed

Neovim doesn't have this problem, as they removed the ttyterm option. Maybe Vim can do the same.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Jul 5, 2020, 1:46:33 PM7/5/20
to vim/vim, Subscribed

There is no 'ttyterm' option. Did you mean 'ttymouse'?
I don't see how it can work without that option on all kinds of terminals.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Jul 5, 2020, 1:56:41 PM7/5/20
to vim/vim, Subscribed

I cannot reproduce the original problem, and installing alacritty fails (or seems to succeed but then fails on startup).


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Keith Bowes

unread,
Jul 5, 2020, 6:24:43 PM7/5/20
to vim/vim, Subscribed

There is no 'ttyterm' option. Did you mean 'ttymouse'?
I don't see how it can work without that option on all kinds of terminals.

LOL, I should have RTFA before commenting. Anyway, the removal is documented (Differences between Nvim and Vim), but I don't know how it's handled internally.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Erick Paquin

unread,
Jan 5, 2023, 11:00:38 AM1/5/23
to vim/vim, Subscribed

Being that vim works fine on most emulators and has since 1847, I'm not sure it should be on vim's part to make sure it works on all possible emulators people put out. Perhaps it should be the other way around, the emulator creators should make sure it is compatible with vim (if that's what they want). Otherwise that is exactly what those vimrc files are for. For odd corner cases and configurations like this. Just my 2 cents.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/4596/1372405430@github.com>

Bram Moolenaar

unread,
Jan 5, 2023, 11:41:47 AM1/5/23
to vim/vim, Subscribed

As I mentioned, I cannot reproduce it (just tried again) and I can't guess what the problem is. Changing 'ttymouse' only changes what mouse codes are recognized, I can't imagine it causing a hang.
So, unless someone who can reproduce it gets Vim to hang in a debugger and tell us what is wrong, there is nothing that can be done.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/4596/1372457521@github.com>

C.D. MacEachern

unread,
Jan 29, 2023, 12:45:07 PM1/29/23
to vim/vim, Subscribed

In your .vimrc just add:

if $TERM == 'alacritty' | set ttymouse=sgr | endif


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/4596/1407726306@github.com>

Bram Moolenaar

unread,
Jan 30, 2023, 8:34:40 AM1/30/23
to vim/vim, Subscribed

About setting 'ttymouse' to "sgr" automatically: If the "XM" termcap entry contains "1006" it should happen automatically.
I'm still working on the terminfo/termcap stuff, but it might help to make sure the "XM" entry in terminfo is set appropriately. See just above ":help kitty-terminal".


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/4596/1408641273@github.com>

Reply all
Reply to author
Forward
0 new messages