Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kitty remote terminal colors change after editing / deleting file from nnn #1992

Open
7 of 9 tasks
jose-elias-alvarez opened this issue Feb 3, 2025 · 1 comment
Open
7 of 9 tasks
Labels

Comments

@jose-elias-alvarez
Copy link

Context: this issue involves an interaction between Kitty's SSH functionality, specifically its ability to apply a color scheme when connecting to a remote host. Kitty correctly applies its color scheme when connecting, but after editing or deleting a file via nnn, the terminal's colors change and no longer match the theme. This issue has more context + screenshots.

I originally assumed that this was a Kitty issue, but in a comment, Kitty's maintainer (who knows an awful lot more about this stuff than I ever will) indicated that the issue is on nnn's side:

It will be because the terminal program is directly resetting colors instead of
using the PUSH/POP escape codes to save colors on the color stack. You
should report the issue to the developers of the file manager. They
should use the XTPUSHCOLORS/XTPOPCOLORS escape codes.

It's also worth noting that I've replicated the same issues with several other terminal-based file managers, including ranger, mc, and vifm. The only one I've tried that seems to handle this case correctly is yazi, which hints that there's something nnn could do differently here. (Of these, nnn is by far my favorite option, which is why I'm reporting it here.)

Environment details (Put x in the checkbox along with the information)

  • Operating System: host is on macOS Sequoia 15.3, remote is on Debian 12
  • Desktop Environment: N/A
  • Terminal Emulator: kitty 0.39.1
  • Shell: fish (3.7.1 on host, 3.6.0 on remote)
  • Custom desktop opener (if applicable):
  • Program options used: replicates with defaults
  • Configuration options set: replicates with defaults
  • Plugins are installed
  • Issue exists on nnn master

Exact steps to reproduce the issue

  1. Install the latest version of Kitty and configure it apply a color scheme when connecting to a remote host. In ~/.config/kitty/ssh.conf:
# exact scheme doesn't matter, just has to match an option in `kitten themes`
color_scheme Challenger Deep
  1. Connect to remote using kitten ssh.
  2. Run the following command to display the current terminal colors, which should match the configured color scheme:
bash -c 'for i in {0..15}; do echo -e "\033[48;5;${i}m Color ${i} \033[0m"; done'
  1. On remote, build nnn from master. In my case (Debian on a Raspberry Pi), I ran the following commands:
sudo apt install pkg-config libncursesw5-dev libreadline-dev
git clone https://github.com/jarun/nnn.git && cd nnn && make
  1. Run the built executable, then edit a file using e or delete a file using x. ($EDITOR seems to be irrelevant, since I was able to replicate with vi, nvim, and nano.)
  2. Exit nnn.
  3. Run the command to print colors again and observe that colors no longer match the color scheme.
@N-R-K
Copy link
Collaborator

N-R-K commented Feb 9, 2025

They should use the XTPUSHCOLORS/XTPOPCOLORS escape codes.

Does ncurses support this?

I've replicated the same issues with several other terminal-based file managers, including ranger, mc, and vifm

Probably because these are all ncurses based. And yazi, I assume, is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants