Style IME pre-edit text with italics and a dashed underline - #10386
Merged
Merged
Conversation
Pre-edit text was drawn in reverse video, which is a solid inverted block moving through the line as you compose. Draw it as italic with a dashed underline in the highlight color instead. Underline rather than reverse video is what other terminals do: VTE renders the pre-edit run with the input method's own attributes and marks only the cursored cell distinctly, and foot underlines the run explicitly, excluding the part under the cursor. Dashed avoids the underline styles applications already use: curly for spell checking and straight for hyperlinks, which is the collision that made reverse video look like the safer choice. The styling is applied to the overlay's own cursor and restored afterwards, alongside the wrap, cursor-visibility and insert-replace modes already saved there. The previous code toggled reverse with XOR, which restored itself; the three new attributes are saved and put back explicitly. Closes kovidgoyal#10382
Contributor
Author
|
Thank you! (Apologies for the formatting miss, wrong clang-format version locally. Will use ./autoformat in future.) |
Owner
|
No worries! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per your instruction on #10382: pre-edit text is now italic with a dashed
underline in the highlight color, rather than reverse video.
One thing to check, since your wording could be read either way: I took "color
being the highlight color" to mean the underline's colour, so it sets
decoration_fgand the text keeps its normal foreground. That matches theurl_style/url_colorpair, whereurl_coloris the decoration colour, and itavoids drawing the text itself in
selection_background(#fffacdby default),which would be close to invisible on a light theme. If you meant the text
colour, it is a one-line change to
sgr.fg.The highlight color resolves through
colorprofile_to_color_with_fallback()from
highlight_bg, falling back todefault_fgwhen selection colours areunset or special.
The previous code toggled
reversewith XOR, so it restored itself. The threenew attributes are saved and put back explicitly, next to the wrap,
cursor-visibility and insert-replace modes already saved there.
Test added, asserting the rendered cells are italic, not reversed, decoration 5,
and
decoration_fgpacked as RGB with the selection background; plus that thestyling does not leak into the screen's own cursor. Verified against the built
binary:
Full suite passes here apart from two failures unrelated to this change and
present on master:
open_actionsargument splitting, andglfw-wayland.so,which this machine cannot build (its wayland-protocols predates
cursor-shape-v1).