yazi: Tmux: cursor flickering and changing shape after exiting yazi
What system are you running Yazi on?
macOS
What terminal are you running Yazi in?
iTerm2
yazi --debug output
Yazi
Version: 0.4.3 (da36cd6 2025-01-25)
Debug : false
Triple : aarch64-apple-darwin (macos-x86_64)
Rustc : 1.84.0 (9fc6b431 2025-01-07)
Ya
Version: 0.4.2 (5cfcab3 2024-12-20)
Emulator
TERM : Some("screen-256color")
TERM_PROGRAM : Some("tmux")
TERM_PROGRAM_VERSION: Some("3.5a")
Brand.from_env : Some(Iterm2)
Emulator.detect : Emulator { kind: Left(Iterm2), light: false, cell_size: Some((22, 46)) }
Emulator.detect_full: Ok(Emulator { kind: Left(Iterm2), light: false, cell_size: Some((22, 46)) })
Adapter
Adapter.matches: Iip
Desktop
XDG_SESSION_TYPE : None
WAYLAND_DISPLAY : None
DISPLAY : Some("/private/tmp/com.apple.launchd.OFWAud2SO1/org.xquartz:0")
SWAYSOCK : None
HYPRLAND_INSTANCE_SIGNATURE: None
WAYFIRE_SOCKET : None
SSH
shared.in_ssh_connection: false
WSL
WSL: false
Neovim
NVIM : false
Neovim version: No such file or directory (os error 2)
Variables
SHELL : Some("/usr/local/bin/zsh")
EDITOR : Some("subl -w")
VISUAL : None
YAZI_FILE_ONE : None
YAZI_CONFIG_HOME: None
YAZI_ZOXIDE_OPTS: None
FZF_DEFAULT_OPTS: None
Text Opener
default : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: false, orphan: true, desc: "$EDITOR", for_: None, spread: true })
block-create: Some(Opener { run: "exiftool \"$1\"; echo \"Press enter to exit\"; read _", block: true, orphan: false, desc: "Show EXIF", for_: None, spread: false })
block-rename: Some(Opener { run: "exiftool \"$1\"; echo \"Press enter to exit\"; read _", block: true, orphan: false, desc: "Show EXIF", for_: None, spread: false })
Multiplexers
TMUX : true
tmux version : tmux 3.5a
tmux build flags : enable-sixel=Unknown
ZELLIJ_SESSION_NAME: None
Zellij version : No such file or directory (os error 2)
Dependencies
file : 5.41
ueberzugpp : No such file or directory (os error 2)
ffmpeg/ffprobe: 7.1 / 7.1
pdftoppm : No such file or directory (os error 2)
magick : 7.1.1-43
fzf : 0.58.0
fd/fdfind : 10.2.0 / No such file or directory (os error 2)
rg : 14.1.1
chafa : No such file or directory (os error 2)
zoxide : No such file or directory (os error 2)
7zz/7z : 24.09 / No such file or directory (os error 2)
jq : 1.6
Clipboard
wl-copy/paste: No such file or directory (os error 2) / No such file or directory (os error 2)
xclip : No such file or directory (os error 2)
xsel : No such file or directory (os error 2)
Describe the bug
When moving through files, the cursor appears flickers in the preview panel and then returns back to the upper left corner. When switching between multiple images, the flickering of the cursor is quite evident. This only happens when running yazi in tmux. Just to avoid misunderstanding, the rendering of the images (mp4, images, and pdf) is correct.
Moreover, when exiting Yazi, the cursor shapes changes from a beam shape | to a block shape. The block shape is also the shape of the cursor is visibly flickering in Yazi.
Probably you need to move the cursor very quickly up and down to preview images. But why not to hide the cursor like with tput civis and then re-enabling it once exiting yazi, just the same cursor it was originally?
I am running under macos. My $TERM is screen-256color. My tmux version is 3.5a. My Yazi version is 0.4.2 (5cfcab3 2024-12-20).
PS: Thank you for the fantastic file manager!
Minimal reproducer
Just run yazi in tmux and scroll through several image files. You notice a flickering of the cursor in the preview panel and in the upper left corner.
Important: the cursor changes shape only when I run multiple tmux windows. Just create a few windows to check whether you can reproduce the behavior. If I have just one window, I observe the strange behavior after exiting yazi and then creating a new window. The new window will be created with a cursor different than my default one.
Anything else?
No response
Checklist
- I tried the latest nightly build, and the issue is still reproducible
- I updated the debug information (
yazi --debug) input box to the nightly that I tried - I can reproduce it after disabling all custom configs/plugins (
mv ~/.config/yazi ~/.config/yazi-backup)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (6 by maintainers)
Thanks for the reply! When I have time, I will make some changes, and if successful make a PR.
Regarding the latency in starting, well, it is a bit sad for me that my old intel mac is not so performing as much as Apple arm/Silicon processors. I bought in 2017 an iMac Pro with 16 cores and a lot of ram. I did not want to replace it yet, although on single core performance, my laptop MacBook Pro M2 is much faster.
One possibility to avoid the latency is a lazy start of the function querying tmux.
Hopefully, I will find a solution for the cursor changing all the times, which I think it is more important than removing the initial latency.
Anyhow, these are just cosmetic improvements. But Yazi is already so nicely crafted that I thought it was worth polishing the last tiny bit.
I don’t want to introduce a new config for it because it’s not a feature, but more of a tmux-specific hack, especially since Yazi’s image preview is meant to be zero-config and work out of the box for all users.
This hack just shows and hides the cursor, and I don’t think it’ll impact performance.
tmuxshould be able to handle it quickly; it’s mostly just a brief visual flicker. If you really care about it, finding a better hack that doesn’t require switching the cursor would be a better approach, and I’d accept a PR if it proves effective.Yazi will query the user’s cursor shape with
DECRQMand restore it upon exit, buttmuxitself doesn’t support this, so Yazi has to pass it through to the user’s actual terminal.But, the passthrough in
tmuxdoesn’t work well with multiple windows becausetmuxdoesn’t provide a way to forward the response only to the currently active window. Please read through https://github.com/sxyazi/yazi/issues/2050.