Friday, May 12, 2023

Re: Odd behavior of vim over ssh from Cygwin mintty

On 2023-05-11, Gary Johnson wrote:
> I haven't had to use Windows for almost a year and I hardly ever use
> a mouse with vim, so I don't know when this behavior might have
> changed, but I was verifying the behavior of vim on Ubuntu over an
> ssh connection from Cygwin's mintty when I noticed something odd.
>
> Using the mouse, I attempted to visually-select a region of text to
> verify that the command/status line showed the number of lines
> selected. Instead of doing that, a small decimal number followed by
> the letter 'm' appeared where the number of lines selected usually
> appears and no lines were selected. A little more experimentation
> suggested that the number was the screen line number.
>
> That was using my local build of Vim 9.0.1482 with my normal config
> files. The odd behavior did not appear with that version using
> "--clean" and did not appear with the version of vim in
> /usr/bin/vim, Vim 8.1.2269 plus patches 3612, 3625, 3669 and 3741,
> with my normal config files.
>
> I just discovered that the odd behavior also happens when using
> GNOME Terminal 3.44.0 on a different Ubuntu machine over ssh to the
> original Ubuntu machine. An xterm works fine.
>
> Before I start digging into my configuration files looking for the
> problematic setting, does anyone know what the problem might be?

I found the problem.

For many years, vim had been unable to properly set the value of
'ttymouse' for some of the terminals I used. Consequently, I added
some code to my vimrc to use the value of the termresponse to
determine the terminal type and to select a value of 'ttymouse' that
seemed to work well with that terminal. A value that often worked
well was "xterm2".

When patch 9.0.1168 was added (on January 10, 2023), vim's method of
determining the value of 'ttymouse' and the control sequences to
enable and disable the mouse changed. The control sequences for
ttymouse=xterm2 were no longer correct for a Cygwin mintty nor for
a GNOME Terminal, at least not when vim had chosen ttymouse=sgr.
The result was the odd behavior I observed.

My current solution is to use my method for determining the value of
'ttymouse' when the patch level is less than 9.0.1168 and accept the
value chosen by vim otherwise.

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230512094958.GF21381%40phoenix.

No comments: