[X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.56.3 (add1aec)
OS
[X] Linux
[ ] macOS
[ ] Windows
[ ] Etc.
Shell
[X] bash
[ ] zsh
[ ] fish
Problem / Steps to reproduce
start urxvt
fzf <<<a, press enter
tmux
cat a file with long lines, they won't be split into multiple lines
I've diagnosed what's causing this and I believe it's because of https://github.com/junegunn/fzf/commit/4cd37fc02b4491d4c9a5f6a27ad41895ad1a62cc - wrapping \e[?1049l (exit alternate screen) in a pair of \e[?7l (no wrap) and \e[?7h (wrap) causes urxvt to preserve the no wrap mode in the alternate screen flags. For reasons I don't quite understand, neither tmux nor neovim reset the wrap flag but they just assume it's at its default value (wrap enabled), so once they switch to the alternate screen, the wrap is disabled but they don't expect that.
The same broken terminal state that fzf leaves behind can be reproduced by doing tput smcup; tput rmam; tput rmcup.
I think the fix might involve not using the flush wrapper for CSI sequences, as these can be output directly with no worry about line wrapping.
(It's worth noting that xterm does not save/restore the wrap flag when switching to/from the alternate screen and therefore isn't affected by this issue, and other terminals might implement this in a different way as well.)
Checklist
man fzf
)Output of
fzf --version
0.56.3 (add1aec)
OS
Shell
Problem / Steps to reproduce
urxvt
fzf <<<a
, press entertmux
I've diagnosed what's causing this and I believe it's because of https://github.com/junegunn/fzf/commit/4cd37fc02b4491d4c9a5f6a27ad41895ad1a62cc - wrapping
\e[?1049l
(exit alternate screen) in a pair of\e[?7l
(no wrap) and\e[?7h
(wrap) causes urxvt to preserve the no wrap mode in the alternate screen flags. For reasons I don't quite understand, neither tmux nor neovim reset the wrap flag but they just assume it's at its default value (wrap enabled), so once they switch to the alternate screen, the wrap is disabled but they don't expect that.The same broken terminal state that fzf leaves behind can be reproduced by doing
tput smcup; tput rmam; tput rmcup
.I think the fix might involve not using the
flush
wrapper for CSI sequences, as these can be output directly with no worry about line wrapping.(It's worth noting that xterm does not save/restore the wrap flag when switching to/from the alternate screen and therefore isn't affected by this issue, and other terminals might implement this in a different way as well.)