Skip to content

Add opt-in ghostel-line-spacing for padded terminal rows#536

Merged
dakra merged 1 commit into
mainfrom
feat/ghostel-line-spacing
Jul 13, 2026
Merged

Add opt-in ghostel-line-spacing for padded terminal rows#536
dakra merged 1 commit into
mainfrom
feat/ghostel-line-spacing

Conversation

@dakra

@dakra dakra commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Follow-up to #535 / discussion #534: an escape hatch for users who want padded terminal lines despite the tradeoffs.

New ghostel-line-spacing defcustom (integer = extra pixels below each row, float = fraction of the line height; same semantics as Emacs' line-spacing, cons form unsupported since the sizing math cannot see it). Default 0 is a behavioral no-op — this changes nothing for existing setups.

What it does when set:

  • Applies buffer-local line-spacing at mode init. Grid sizing needs no changes — window-screen-lines divides by default-line-height, which includes buffer-local spacing.
  • ghostel--reported-cell-height now includes the spacing (new ghostel--cell-height helper), so XTWINOPS CSI 14/16 t replies and kitty placement grid_rows math match the rendered rows instead of under-reporting by the spacing ratio.
  • The custom :set updates live terminals immediately (buffer-local value + forced ghostel--adjust-size per window), avoiding the stale grid that a raw setq would leave until the next window resize (nothing fires on line-height-only changes — the window's pixel size is unchanged).

Known cosmetic cost, documented in the docstring and README table row: Emacs draws no content into the spacing strip, so non-zero values leave horizontal gaps in everything that tiles vertically — box-drawing borders, block characters, half-block image output, and kitty image rows. Kitty tiling is deliberately left unchanged: buffer line-spacing is applied per glyph in redisplay, so image rows pad below their slice exactly like text rows (uniform cell-height rows); no newline line-height property can make the slices flush (numeric, (HEIGHT TOTAL), and t forms all verified ineffective against per-glyph spacing).

Verified live (GUI Emacs): integer and float spacing size the grid and SIGWINCH correctly (33→27 rows at 3px, 33→30 at 0.1); customize-set-variable mid-session resizes 33→23 rows and back with zero vscroll; CSI 14 t reports exactly rows × reported cell height; kitty images render uniform cell-height rows at spacing 6 and are pixel-identical to main at spacing 0; box-drawing shows only the documented gaps. Includes three batch ERT tests (mode init, live :set propagation, cell-height arithmetic).

New defcustom applies buffer-local line-spacing (integer pixels or a
float fraction of the line height) in ghostel buffers.  The grid
sizing already follows the taller rows through window-screen-lines;
the reported cell pixel height now includes the spacing so XTWINOPS
replies and kitty placement math match rendered rows, and the custom
setter resizes open terminals immediately instead of leaving a stale
grid until the next window resize.

Default 0 keeps current behavior.  Non-zero values leave gaps in
everything that tiles vertically (box-drawing, block characters,
kitty image rows) since Emacs draws no content into the spacing
strip; the docstring and README row document this.
@dakra dakra force-pushed the feat/ghostel-line-spacing branch from e333494 to 9a4256a Compare July 13, 2026 16:40
@dakra dakra merged commit 9a4256a into main Jul 13, 2026
28 checks passed
@dakra dakra deleted the feat/ghostel-line-spacing branch July 13, 2026 17:18
@dakra dakra temporarily deployed to github-pages July 13, 2026 17:19 — with GitHub Actions Inactive
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.

1 participant