Thank you Thomas, Dominik, and Chris for your replies.

tl;dr is that there was a vim bug between version 8.2.2345 Jan 14 2021
and 8.2.2564 Mar 3 2021, and the ubuntu 21.04 vim 8.2.2434 has the bug.


Chris's mention of xterm FocusIn/FocusOut led me down the right path.

vim 8.2.2345 added support for enabling FocusIn/FocusOut features,
but missed not enabling it if vim's "noesckeys" option is set.

If "noesckeys" is set, the FocusOut escape sequence from xterm is handled
as ESC, then [ then O - which ends insert, then beeps at the O.
Otherwise it could run an autocmd is one is set.

Why did I think this was fvwm related?  I think xterm only gets these events
with a suitably modern window manager.

I tried it with old window managers (ctwm, vtwm) and with no window
manager, and I only saw it with fvwm.  I should have tried with some
other modern window manager, but didn't really have one handy. (Sorry.)

This vim bug only showed up if "noesckeys" was set - I set "compatible"
(I'm old school vi-wise), which sets "noesckeys".  So you need a particular
vim patch level, and esckeys turned off to replicate it.

And just in case you're interested, or anyone else stumbles on this,
setting these X resources seems to be a suitable workaround for me, until
ubuntu updates vim:
    XTerm*allowMouseOps: false
    XTerm*disallowedMouseOps: FocusEvent

Thanks again for your help, and apologies for my unintended digression!

John


| When I have the vim editor open in an xterm window, in insert mode,
| and move my mouse (and focus) into another window, the vim in the
| original window receives some sort of escape sequence that causes
| it to leave insert mode and beep.

Reply via email to