Description
nvim --version
: NVIM v0.4.0-633-g82cbcc6f3- Vim (version: ) behaves differently? yes
- Operating system/version: Ubuntu 18.04.2
- Terminal name/version: termite (gnome-terminal also affected, xterm not affected)
$TERM
: xterm-termite (xterm-256color for gnome-terminal)
Steps to reproduce using nvim -u NORC
thinkbox ~% nvim ~/a
(press ^Z: suspend)
thinkbox 1? ~% nvim ~/a
(swapfile detected, press a: abort)
^[[Ithinkbox 1? ~%
Actual behaviour
^[[I
is TYPED into the shell.
Expected behaviour
^[[I
is not typed into the shell.
Explanation
Neovim sends ^[[?1004h
to the terminal to enable focus gained / lost reporting.
The terminal emulator reports focus gained to Neovim by typing ^[[I
and reports focus lost by typing ^[[O
.
It seems that libvte (termite, gnome-terminal) also reports the current focus state (^[[I
/^[[O
) directly after enabling this mode. Xterm doesn't, so that's why xterm is not affected by this bug.
When pressing a
(bort) in the swap file dialog, it seems Neovim immediately stops grabbing the input, so all characters typed thereafter are typed into the shell. (Catting a file containing ^[[?1004h
causes the same issue)
Luckily both bash and zsh seem to ignore typing ^[[I
(aka <esc>[I
) (unless you have bound it). My issue was that I had bound <esc>
to <noop>
, so everytime I aborted Neovim [I
appeared typed in my shell.
Typing any character before pressing a
(even scrolling the mouse in the window) makes the problem disappear. Also using q
instead of a
is a good workaround.