wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.03k stars 768 forks source link

undercurl not showing in bash (WSL, windows 11, stable and nightly build) #3590

Closed d-r-a-b closed 1 year ago

d-r-a-b commented 1 year ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

wezterm 20230421-075330-e0a92c73

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Read the FAQ on undercurl at https://wezfurlong.org/wezterm/faq.html?h=undercurl#how-do-i-enable-undercurl-curly-underlines and it seemed like undercurl has been supported/working for a while. When I tried it, however, I didn't have any luck.

image

Happens on stable and latest nightly. I'm sure I must be doing something wrong, but I can't figure it out. I tried return {} in my .wezterm.lua to make sure that it wasn't a weird config thing that I was setting too.

To Reproduce

  1. Start Wezterm
  2. wsl ~
  3. bash termescapes.sh
#!/bin/sh
echo -e "\e[1mbold\e[0m"
echo -e "\e[3mitalic\e[0m"
echo -e "\e[3m\e[1mbold italic\e[0m"
echo -e "\e[4munderline\e[0m"
echo -e "\e[9mstrikethrough\e[0m"
echo -e "\e[31mHello World\e[0m"
echo -e "\x1B[31mHello World\e[0m"
printf "\x1b[58:2::255:0:0m\x1b[4:1msingle\x1b[4:2mdouble\x1b[4:3mcurly\x1b[4:4mdotted\x1b[4:5mdashed\x1b[0m\n"

Configuration

return {}

Expected Behavior

I see undercurl

Logs

Debug Overlay
wezterm version: 20230421-075330-e0a92c73 x86_64-pc-windows-msvc
Window Environment: Windows
WebGPU: name=Intel(R) UHD Graphics 630, device_type=IntegratedGpu, backend=Vulkan, driver=Intel Corporation, driver_info=Intel driver, vendor=32902, device=16027
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
>

No logfile in $HOME/.local/share/wezterm

Anything else?

No response

wez commented 1 year ago

the conpty layer of windows doesn't support undercurl, and effectively strips it from the output:

If you use wezterm ssh or wezterm's multiplexing feature to connect directly to the linux environment, you can bypass conpty and see your undercurl

d-r-a-b commented 1 year ago

ah I see. Thank you for the quick reply!

closing the issue

d-r-a-b commented 1 year ago

I've really got to say, the documentation for this project is top-notch.

Anyone who finds this issue will be well-served by https://wezfurlong.org/wezterm/what-is-a-terminal.html#terminal-emulators-and-ptys for a conceptual understanding of the role of ConPTY in wezterm and other terminal emulators running on Windows. Scroll up for even more context if the linked section doesn't make sense to you.

nhat-vo commented 1 year ago

@d-r-a-b I have actually been stuck in configuring this direct connection to the Linux layer. Could you perhaps elaborate on how you manage to connect to wsl directly? Did you use wezterm ssh or the multiplexing feature?

For wezterm ssh, I tried hosting a ssh server inside the wsl instance, then connecting to it using wezterm ssh USERNAME@localhost. This successfully connects to the wsl instance, but the undercurl issue still persists image

The multiplexing feature seems interesting, but I was quite confused by the guide. What does it means to have the configuration inside the wsl and in win32 as well? Does it mean I need to have wezterm installed in both windows and wsl? (I'm using wsl2 by the way, and I tried setting the proxy command

proxy_command = { 'nc', '-U', '/Users/wez/.local/share/wezterm/sock' },

but it also does not work).

EDIT: Actually using the snippet in the FAQ works for wezterm ssh. However, do you know if there is any other way than this? Having to turn on the ssh server is rather inconvenient.

d-r-a-b commented 1 year ago

However, do you know if there is any other way than this? Having to turn on the ssh server is rather inconvenient.

No, I doubt there is any better method at this moment. The true fix will be ConPTY not filtering out these escape sequences. See my comment with link to the documentation above for why this is so. See also the maintainer's reply to my initial post, linking to the relevant microsoft/terminal issue.

nhat-vo commented 1 year ago

I see... I just thought there is some other way using the multiplexing feature, as mentioned in here (for wsl2 then we can add the nc for ProxyCommand mentioned shortly before in the link.

So you are using wezterm ssh to connect to the ssh server inside the wsl instance, is that correct?

d-r-a-b commented 1 year ago

I already knew what would be involved in running a ssh server and decided it wasn't worth it for undercurl support in my case. I am unclear on the status of multiplexing through unix sockets on WSL2. However, in the page you linked:

This example shows a redundant use of nc (netcat) to connect to the unix socket path on my mac. This isn't useful on its own [emphasis mine], but may help with the WSL 2 issue mentioned below when translated to an appropriate invocation of netcat/socat on Windows:

Note: this only works with WSL 1. WSL 2 doesn't support AF_UNIX interop

I haven't explored this deeply; you may find a way to make it work but I have no real further info at this time. It would be really cool if you do figure it out.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.