Avoid redundant terminal size queries during history insertion (#39100)

## What changed

- Pass the screen size already available to TUI draw and history-tail paths into history insertion.
- Use the terminal's cached screen size for direct history insertion calls instead of querying the backend again.
- Extend the terminal size-query regression test to cover history insertion.

GitOrigin-RevId: 44c7a0f0bc5bc365d8d0c72d7e26587ed17a4821
This commit is contained in:
Tamir Duberstein authored and copyberry committed 2026-08-17 22:58:25 +00:00
1 parent fd34ad7297
commit 050aa077b5
5 files changed
+21 -2

No files matched your search

+4
View File
@@ -932,6 +932,7 @@ impl Tui {
terminal: &mut Terminal,
pending_history_lines: &mut Vec<PendingHistoryLines>,
is_zellij: bool,
screen_size: Size,
) -> Result<()> {
if pending_history_lines.is_empty() {
return Ok(());
@@ -948,6 +949,7 @@ impl Tui {
&batch.lines,
mode,
batch.wrap_policy,
screen_size,
)?;
}
pending_history_lines.clear();
@@ -1006,6 +1008,7 @@ impl Tui {
terminal,
&mut self.pending_history_lines,
self.is_zellij,
screen_size,
)?;
// Update the y position for suspending so Ctrl-Z can place the cursor correctly.
@@ -1121,6 +1124,7 @@ impl Tui {
terminal,
&mut self.pending_history_lines,
self.is_zellij,
screen_size,
)?;
if needs_full_repaint || history_can_overlap_viewport {