Skip to content

Let icons claim spaces whose style is invisible on blanks - #728

Merged
dakra merged 1 commit into
mainfrom
fix/icon-styled-space-claim
Oct 12, 2026
Merged

dakra merged 1 commit into
mainfrom
fix/icon-styled-space-claim

Conversation

@dakra

@dakra dakra commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Fixes #727.

Problem

adjustWidth lets a standalone oversized glyph (e.g. a nerd-font icon) claim the following blank cell and hides that space with (space :width 0). followingCellProtected blocked the claim whenever the space's run had any CellPropKey — that includes bold, a foreground color, a hyperlink, and OSC 133 prompt/input semantic content.

lsd and eza wrap icon, space and name in one SGR span, and shell prompts are semantic content, so icons in ls output and in prompts were squeezed into one cell and rendered at about half size.

Change

CellPropKey.spaceVisiblyStyled decides whether hiding the space would lose something visible: a background color (cell or style), inverse, underline, strikethrough or overline. Only those spaces, plus the cursor cell, stay protected. The lookup runs only for oversized standalone glyphs.

Tests

Native glyph tests, one per case:

  • claims: bold, foreground-colored, and prompt spaces
  • does not claim: background-colored, background-erased, and underlined spaces (existing cursor and inverse tests unchanged)

Each background branch was checked by removing it and confirming its test fails.

Verified live in a GUI Emacs with lsd --icon always --color always and an icon in the bash prompt: icons render at full height, columns stay aligned, and bg/inverse/underline spaces remain visible.

adjustWidth refused to claim the space after a standalone oversized
glyph whenever that space carried any cell property: bold, a
foreground color, a hyperlink or OSC 133 prompt/input semantics.
lsd and eza wrap icon, space and name in one SGR span, and shell
prompts are semantic content, so nerd-font icons there were squeezed
into a single cell and rendered at about half size.

Only protect the space when hiding it loses something visible: the
cursor cell, a background color, inverse, underline, strikethrough or
overline.
@dakra
dakra requested a review from emil-e October 11, 2026 11:04
@dakra
dakra merged commit ebc430d into main Oct 12, 2026
33 checks passed
@dakra
dakra deleted the fix/icon-styled-space-claim branch October 12, 2026 06:41

This branch was previously deployed

1 inactive deployment
github-pages — ebc430d0 Deployed Oct 12, 2026 by dakra via deploy #210
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nerd-font icons render at half size when the space after them is styled (0.57.0, regression of #281)

2 participants