feat(terminal): report text-area size via XTWINOPS (CSI 14/18 t)#67
Draft
roramirez wants to merge 1 commit into
Draft
feat(terminal): report text-area size via XTWINOPS (CSI 14/18 t)#67roramirez wants to merge 1 commit into
roramirez wants to merge 1 commit into
Conversation
Reply to CSI 18 t with the text-area size in cells (CSI 8 ; rows ; cols t) and to CSI 14 t with the size in pixels (CSI 4 ; height ; width t). fzf and tmux use these to compute layouts. Cell pixel size is carried to the parser thread by extending the pending-resize signal and mirrored onto the grid as `cell_px`. Collapse the DECSET/DECRST arms into `h | l` patterns while in the file.
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 XTWINOPS text-area size reports:
CSI 18 t→CSI 8 ; rows ; cols t(size in character cells).CSI 14 t→CSI 4 ; height ; width t(size in pixels).fzf and tmux query these to compute layouts and preview windows. Cell size in cells was already known to the parser; the pixel report additionally needs the cell pixel size, which is carried from the main thread.
Changes
src/terminal/parser.rs: new't'CSI arm delegating tohandle_xtwinops, which replies for14/18and ignores other window operations. Also collapses the DECSET/DECRST (h/l) arms ofhandle_dec_private_modesinto('h' | 'l', …)patterns (same behavior, fewer lines).src/terminal/grid.rs: addGrid.cell_px: (u32, u32), mirrored fromFontMetricson resize.src/drain.rs: extend the non-blocking resize signal to(cols, rows, cell_w_px, cell_h_px)via a newPendingResizetype alias; apply the cell size onto the grid at both resize-application sites.src/pane_ops.rs,src/app_state.rs: use thePendingResizealias; populate the cell size fromentry.metricswhen signaling a resize.xtwinops_reports_text_area_size(cells, pixels, and an unsupported op); update thepending_resizetuple inpane_ops_test.rs/drain_test.rs.CHANGELOG.md: entry under[Unreleased] / Added.How to test
cargo test(seextwinops_reports_text_area_size; full suite green).printf '\033[18t'replies\033[8;<rows>;<cols>t;printf '\033[14t'replies with the pixel size.Checks
.kimun.tomlfail_below = B); trend is -0.01 at the rounding floor, from the unavoidable indented plumbing added inside the parser event loop. Offset as far as reasonable by simplifying the DEC private-mode setter; further clawback would require gratuitous refactoring of unrelated code.