Add opt-in ghostel-line-spacing for padded terminal rows#536
Merged
Conversation
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.
e333494 to
9a4256a
Compare
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.
Follow-up to #535 / discussion #534: an escape hatch for users who want padded terminal lines despite the tradeoffs.
New
ghostel-line-spacingdefcustom (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). Default0is a behavioral no-op — this changes nothing for existing setups.What it does when set:
line-spacingat mode init. Grid sizing needs no changes —window-screen-linesdivides bydefault-line-height, which includes buffer-local spacing.ghostel--reported-cell-heightnow includes the spacing (newghostel--cell-heighthelper), so XTWINOPSCSI 14/16 treplies and kitty placementgrid_rowsmath match the rendered rows instead of under-reporting by the spacing ratio.:setupdates live terminals immediately (buffer-local value + forcedghostel--adjust-sizeper window), avoiding the stale grid that a rawsetqwould 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-spacingis applied per glyph in redisplay, so image rows pad below their slice exactly like text rows (uniform cell-height rows); no newlineline-heightproperty can make the slices flush (numeric,(HEIGHT TOTAL), andtforms 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-variablemid-session resizes 33→23 rows and back with zero vscroll;CSI 14 treports 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:setpropagation, cell-height arithmetic).