From 6f6cb9292f587cb5d5bcec3636084ced79cbfc95 Mon Sep 17 00:00:00 2001 From: Daniel Somerfield Date: Tue, 5 Dec 2023 20:33:23 -0800 Subject: [PATCH] Checking the start row repeatedly to see how it affects performance --- src/painting/painter.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/painting/painter.rs b/src/painting/painter.rs index 8313f010..bee86429 100644 --- a/src/painting/painter.rs +++ b/src/painting/painter.rs @@ -151,8 +151,14 @@ impl Painter { // Marking the painter state as larger buffer to avoid animations self.large_buffer = required_lines >= screen_height; + // This might not be terribly performant. Testing it out + let is_reset = || match cursor::position() { + Ok(position) => position.1 < self.prompt_start_row, + Err(_) => false, + }; + // Moving the start position of the cursor based on the size of the required lines - if self.large_buffer { + if self.large_buffer || is_reset() { self.prompt_start_row = 0; } else if required_lines >= remaining_lines { let extra = required_lines.saturating_sub(remaining_lines);