Skip to content

Commit

Permalink
Checking the start row repeatedly to see how it affects performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Somerfield committed Dec 6, 2023
1 parent 6f1dd80 commit 6f6cb92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/painting/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Check warning on line 158 in src/painting/painter.rs

View check run for this annotation

Codecov / codecov/patch

src/painting/painter.rs#L154-L158

Added lines #L154 - L158 were not covered by tests

// 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() {

Check warning on line 161 in src/painting/painter.rs

View check run for this annotation

Codecov / codecov/patch

src/painting/painter.rs#L161

Added line #L161 was not covered by tests
self.prompt_start_row = 0;
} else if required_lines >= remaining_lines {
let extra = required_lines.saturating_sub(remaining_lines);
Expand Down

0 comments on commit 6f6cb92

Please sign in to comment.