Skip to content

Commit

Permalink
Fix alternate-screen scrolling
Browse files Browse the repository at this point in the history
The alternate-screen mode disables scrollback. This
means that we delete lines off of the top of the
screen when scrolling, without saving them.

But we weren't keeping a count of those lines, which
meant a stable index was lost; leaving the mux-server
unable to properly track scrolling.

Now we keep track of the stable_row_index_offset, even
when there is no scrollback.  This turns out to be the
exact same logic as when scrollback is enabled, but
after "erase_scrollback" has been called. In both cases,
stable_row_index_offset is used to count the number
of scrollback-lines, that don't exist in the buffer.

As per issue #6166
  • Loading branch information
loops committed Sep 25, 2024
1 parent 2999574 commit aa4b175
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion term/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ impl Screen {
self.lines.remove(remove_idx);
}

if remove_idx == 0 && self.allow_scrollback {
if remove_idx == 0 {
self.stable_row_index_offset += lines_removed;
}

Expand Down

0 comments on commit aa4b175

Please sign in to comment.