-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support different kinds of underline rendering #3015
Conversation
Wrote a PR to add color to the underlines: PR |
Looks great! I wanted support for that too :) |
Adds four new modifiers that can be used in themes: - undercurled - underdashed - underdotted - double-underline
Add underline field to doctests, and fix bugs
The cxterminfo crate has been used over popular alternatives like `term` since it supports querying for extended capabilities and also for it's small codebase size (which will make it easy to inline it into helix in the future if required).
d19926e
to
da52d20
Compare
Added undercurl support detection based on terminfo. Thanks to @A-Walrus for the color customization code :) |
This is really sweet 😀 I took it for a spin and I found some odd behavior when using The asciicast doesn't really show it very well but I have
I also have the
Moving right across the diagnostic doesn't do anything interesting but moving left seems to un-underline the parts of the diagnostic that the primary cursor was on. So I think there might be some conflict with the intersect or resetting behavior? |
This only seems to affect them when the underlines are different, for example when both the error and cursor modifiers are The modifiers used (the cursor is undercurled instead of the error): "diagnostic.error" = { underline = "red", modifiers = ["underlined"] }
"ui.cursor.primary" = { fg = "white", modifiers = ["reversed", "undercurled"] } |
There seems to be no reset call for helix/helix-tui/src/backend/crossterm.rs Lines 119 to 124 in da52d20
|
@@ -153,7 +192,7 @@ impl ModifierDiff { | |||
if removed.contains(Modifier::ITALIC) { | |||
map_error(queue!(w, SetAttribute(CAttribute::NoItalic)))?; | |||
} | |||
if removed.contains(Modifier::UNDERLINED) { | |||
if removed.intersects(Modifier::ANY_UNDERLINE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be that we have to emit NoUnderline
followed by underline if the cell changes from one underline to a different type in the next one?
I tried this on wezterm: the underline color changes, but it's using the same underline (not undercurl). I did confirm that undercurl works normally via
|
|
Seems like wezterm's terminfo file has to installed separately: curl https://raw.githubusercontent.com/wez/wezterm/master/termwiz/data/wezterm.terminfo | tic -x - There's also one more problem at play here even if you have the terminfo file but when it's installed in So to check if wezterm works with undercurl: curl https://raw.githubusercontent.com/wez/wezterm/master/termwiz/data/wezterm.terminfo | tic -x -
export TERM=wezterm
export TERMINFO=~/.terminfo
hx # or cargo run, etc Fixing the cxterminfo bug should remove the |
Tested this out and noticed sometimes the way underlines work in wezterm it's going to be clipped (in other words, there's not enough room for the underlines so it looks funky). I brought it up in the wezterm matrix and there may be upcoming fixes to make it look better in more cases, but I think we should include up front in the documentation that font adjustments may be needed with any given terminal emulator for the fancy underlines to look good. For example, wezterm provides a way to increase the line height and adjust the positioning of the underline to be closer to the text. Any combination of that may be enough to resolve the issue. See matrix discussion in wezterm room for more information: https://matrix.to/#/!PirwUBcuIlTXwNveYz:matrix.org/$muIHcpgbicXxPXLFuxvfXEMmPg-oqmGu0drVRc_UnA4?via=matrix.org&via=kde.org&via=mozilla.org |
Closing in favor of #4061. |
Adds four new modifiers that can be used in themes:
undercurled
underdashed
underdotted
double-underline
TODO