Repository navigation
Conversation
Reading the whole scrollback (to copy it out, as a multiplexer's copy mode does) meant stepping set_scrollback through it a screenful at a time and calling Screen::cell for each cell, which widens each row it shows and copies cell by cell. line_cells returns a line of scrollback or screen as a slice, by its index from the oldest scrollback row, and line_wrapped its wrap flag, without moving the view.
While the alternate screen is shown, the normal screen it hides could not be read: Screen::cell and Screen::line_cells read the shown grid. Screen::normal_screen_row_cells and normal_screen_row_wrapped give its rows, as they were when the alternate screen came on, which is what tmux's capture-pane -a reads.
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.
Builds on #50 (it returns rows as
Screen::line_cellsdoes); only the lastcommit is new here.
While the alternate screen is shown, nothing reads the normal screen it hides:
Screen::cell,Screen::rowsandScreen::line_cellsall read the shown grid,and the normal one is private. A terminal multiplexer needs it for tmux's
capture-pane -a, which captures exactly that (tmux'ssaved_grid: the normalscreen's rows as they were when the alternate screen came on).
Screen::normal_screen_row_cells(row): the cells of that row of the normalscreen while the alternate screen is shown;
Noneotherwise or past the lastrow.
Screen::normal_screen_row_wrapped(row): whether that row wraps.Entering the alternate screen already resets the normal grid's scrollback
offset, so its visible rows are the screen as it was.
Test
tests/mode.rs:normal_screen_rows_read_under_the_alternate_screen(Nonebefore and after the alternate screen; the rows, a wrapped one among them,
while it shows). It fails when the shown grid is read instead, and when the
alternate-screen check is dropped.
cargo nextest run --all-targets, doc tests,cargo clippy --all-targets -- -Dwarnings,cargo fmt --check,cargo docand
cargo +1.85.0 check --lib --all-featurespass locally.