wez / wezterm

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

Undercurl cutoff #3157

Closed boltlessengineer closed 1 year ago

boltlessengineer commented 1 year ago

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

macOS

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

No response

WezTerm version

wezterm 20230224-171344-c5247d21

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

스크린샷 2023-02-25 오후 9 34 48

When using Undercurl, the line below is cut off. This makes undercurl look less squiggly. This makes distinguishing undercurl from normal underline much harder.

To Reproduce

The picture above is from Neovim, but this can be also reproduced with code from Wezterm's FAQ section.

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 {
  font = wezterm.font_with_fallback {
    'Fira Code',
  },
  font_size = 16.0,
  underline_position = "800%",
  underline_thickness = "1.5pt",
}

Expected Behavior

No response

Logs

No response

Anything else?

Currently I put my underlines at bottom end of the cells. I can just adjust the underline position more higher to fix cutoff issue, but supporting bottom-most undercurl would be nice.

Also, there was similar issue about 2 years ago. (#734)

wez commented 1 year ago

If you remove the underline_position from your config, do the underlines not get cut off?

boltlessengineer commented 1 year ago

They don't get cut off when I remove underline_position. The issue only happens when I put underline at the bottom of the cell. I want to set underline's position there because they looks great with indent-blankline.nvim Neovim plugin.

Is this intended behavior?

wez commented 1 year ago

Yeah, this is working as intended: the underline is pre-rendered into a cell sprite and is (very quickly) composited into underlined cells by the GPU. Your configuration makes the underline render outside the bounds of the cell sprite, so the part that is outside the bounds of the cell are clipped away.

boltlessengineer commented 1 year ago

So there are no way to print undercurl on top of the under cell.

How about modifying undercurl's starting position a bit? I mean like -cosine curve. I don't know exactly how undercurl is rendered, so I might be wrong. But if it is possible, we can have a continuous curve and avoid being cut off by cell boundaries.

Having this feature as an additional option would be great :)

wez commented 1 year ago

https://github.com/wez/wezterm/blob/1f7a34f8b259c58387392e358f5fe54c733e193a/wezterm-gui/src/glyphcache.rs#L751 is the start of the logic in the code. If you can see a way to tweak it, you're welcome to send a PR, but I have no plans to make changes to this myself at this time.

wez commented 1 year ago

I'm going to close this: it is working as intended, and there is nothing more for me to do at this time.

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.