FS#78585 - [ncurses][vim] vim enters -- more -- view when losing focus with testing/ncurses
Attached to Project:
Arch Linux
Opened by Mike Yuan (YHNdnzj) - Wednesday, 24 May 2023, 10:11 GMT
Last edited by Toolybird (Toolybird) - Saturday, 05 August 2023, 21:45 GMT
Opened by Mike Yuan (YHNdnzj) - Wednesday, 24 May 2023, 10:11 GMT
Last edited by Toolybird (Toolybird) - Saturday, 05 August 2023, 21:45 GMT
|
Details
Description:
After upgrading ncurses to 6.4_20230520-1, vim automatically enters -- more -- view when the terminal window loses focus. Downgrading to 6.4-1 resolves the issue for me. Additional info: * package version(s) ncurses 6.4_20230520-1 vim 9.0.1572-1 Steps to reproduce: 1. Open vim 2. Switch to another window |
This task depends upon
Closed by Toolybird (Toolybird)
Saturday, 05 August 2023, 21:45 GMT
Reason for closing: Fixed
Additional comments about closing: "Resolved"
R.I.P. Bram. Legend
Saturday, 05 August 2023, 21:45 GMT
Reason for closing: Fixed
Additional comments about closing: "Resolved"
R.I.P. Bram. Legend
edit: I can't seem to reproduce the problem with ncurses from testing
<https://github.com/vim/vim/issues/12338#issuecomment-1535583086>
One way to fix it, taken from <https://vimhelp.org/term.txt.html#xterm-focus-event>:
```
let &t_fe = "\<Esc>[?1004h"
let &t_fd = "\<Esc>[?1004l"
execute "set <FocusGained>=\<Esc>[I"
execute "set <FocusLost>=\<Esc>[O"
```
Or if using vim9script:
```
execute '&t_fe = "\<Esc>[?1004h"'
execute '&t_fd = "\<Esc>[?1004l"'
execute "set <FocusGained>=\<Esc>[I"
execute "set <FocusLost>=\<Esc>[O"
```
It appears to be working correctly for tmux-* and xterm-*, but not for terminals like alacritty and foot... I've added the following to my .vimrc (vim9script):
```
if &term == 'alacritty' || &term == 'foot'
execute '&t_fe = "\<Esc>[?1004h"'
execute '&t_fd = "\<Esc>[?1004l"'
execute "set <FocusGained>=\<Esc>[I"
execute "set <FocusLost>=\<Esc>[O"
endif
```
It has link to a patch to ncurses to solve it for foot: https://lists.gnu.org/archive/html/bug-ncurses/2023-06/msg00001.html.
On my system, I have an issue with ranger running in foot, when switching focus. The suggested workaround to use the
`foot-terminfo` package solves it for me.