feat(terminal): add SGR double underline (attribute 21)#69
Draft
roramirez wants to merge 1 commit into
Draft
Conversation
Track a per-cell double-underline flag alongside the other SGR attributes and draw it as two horizontal lines below the cell. SGR 24 now clears both single and double underline. Preserved across DECSC/DECRC and the alternate screen like the other attributes. Factor the decoration hlines through a small local closure and collapse the DECSET/DECRST arms of handle_dec_private_modes into `h | l` patterns while in the files.
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.
Summary
Implements the SGR double underline attribute (
ESC[21m): a double line drawn under the cell.ESC[24m(not underlined) clears both single and double underline, matching xterm/VTE. neovim and helix use double underline as one of their diagnostic underlines. Follows the existing SGR attribute pattern (tracked on the pen, stamped per cell, reset by SGR 0/24, preserved across DECSC/DECRC and the alternate screen).Changes
src/terminal/grid.rs: adddouble_underlinetoCell, theGridSGR pen,SavedCursor,SavedScreen, and every default/stamp/reset/save/restore site (mirrors theblinkattribute).src/terminal/parser.rs:handle_sgrarm21(on); extend arm24to clear both single and double underline. Also collapse the DECSET/DECRST (h/l) arms ofhandle_dec_private_modesinto('h' | 'l', …)patterns.src/renderer/text.rs: draw the double underline as twodraw_clipped_hlinecalls; factor the underline/double-underline/strikethrough hlines through a small local closure to remove the repeated argument lists.text_test.rs.CHANGELOG.md: entry under[Unreleased] / Added.How to test
cargo test(seesgr_double_underline_*/sgr_24_clears_single_and_double_underlineinparser_test.rs).printf '\033[21mword\033[0m\n'showswordwith a double underline.Checks
.kimun.tomlfail_below = B); trend -0.02 at the Halstead rounding floor from the new attribute identifier repeated across the redundant SGR pen storage (Cell/Grid/SavedCursor/SavedScreen). Net LOC is negative after factoring the decoration hlines through a closure; keeping the attribute in the Saved* structs is deliberate (consistency with the other attributes).