containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.38k stars 208 forks source link

Curly underline ("undercurl") not working in Neovim + Konsole #1449

Closed notfirefox closed 4 months ago

notfirefox commented 4 months ago

Describe the bug Curly underlines do not work inside of neovim, instead straight underlines are displayed.

Steps how to reproduce the behaviour

  1. Open up Konsole from the host system
  2. Enter a Fedora 39 container using toolbox
  3. Set up a neovim config with LSP
  4. Open a file in neovim with errors
  5. Inspect the style of the underline

Expected behaviour Curly underlines are displayed (this is what it looks like inside of distrobox). image

Actual behaviour Straight underline are displayed (this is what it looks like inside of toolbox). image

Screenshots See above.

Output of toolbox --version (v0.0.90+) toolbox version 0.0.99.5

Toolbx package info (rpm -q toolbox) toolbox-0.0.99.5-2.fc39.x86_64

Output of podman version

Client:       Podman Engine
Version:      4.9.0
API Version:  4.9.0
Go Version:   go1.21.6
Built:        Wed Jan 24 11:07:27 2024
OS/Arch:      linux/amd64

Podman package info (rpm -q podman) podman-4.9.0-1.fc39.x86_64

Info about your OS Fedora KDE 39

Additional context I believe that this issue is specific to toolbox. I have tested this both inside of toolbox and distrobox and for some reason it works inside of distrobox but not inside of toolbox. When I run printenv | grep TERM, the output for both is:

COLORTERM=truecolor
TERM=xterm-256color

However when I run export TERM="alacritty" inside of toolbox, I have curly underlines. But setting TERM to alacritty just after entering the container feels very hacky, therefore a proper solution would be much appreciated.

notfirefox commented 4 months ago

I located the issue. It appears that the KONSOLE_VERSION environment variable is necessary for the curly underline feature to work inside of Konsole. So when I run

[user@toolbox dir]$ export KONSOLE_VERSION="230804"

inside of the toolbox, everything works as expected. 230804 here is the value of this environment variable on my host machine. So I believe we need to forward the environment variable KONSOLE_VERSION to the container.

debarshiray commented 4 months ago

Additional context I believe that this issue is specific to toolbox. I have tested this both inside of toolbox and distrobox and for some reason it works inside of distrobox but not inside of toolbox.

Yeah, this is because Distrobox forwards all environment variables, barring some. Toolbx does the opposite of only forwarding some environment variables.

Generally speaking, we expect most environment variables to be set by the shell's start-up scripts, except some like VTE_VERSION that's injected by VTE itself directly into environment, or more generally TERM for all terminal emulators, and a few others in specific scenarios. KONSOLE_VERSION sounds similar to VTE_VERSION.

debarshiray commented 4 months ago

@notfirefox While grepping through the Neovim sources, I saw that Neovim also uses the XTERM_VERSION environment variable to detect the terminal features supported by xterm. Would you be interested in submitting a similar pull request for that? I use neither Neovim nor xterm on a daily basis, so I felt that you might be in a better position to make the change.

notfirefox commented 4 months ago

@notfirefox While grepping through the Neovim sources, I saw that Neovim also uses the XTERM_VERSION environment variable to detect the terminal features supported by xterm. Would you be interested in submitting a similar pull request for that? I use neither Neovim nor xterm on a daily basis, so I felt that you might be in a better position to make the change.

I do have some time now, so I might just do that.

notfirefox commented 4 months ago

@notfirefox While grepping through the Neovim sources, I saw that Neovim also uses the XTERM_VERSION environment variable to detect the terminal features supported by xterm. Would you be interested in submitting a similar pull request for that? I use neither Neovim nor xterm on a daily basis, so I felt that you might be in a better position to make the change.

@debarshiray PR: https://github.com/containers/toolbox/pull/1460