Skip to content

Commit

Permalink
adjust is_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
WindSoilder committed Jan 4, 2024
1 parent f396223 commit a621724
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/painting/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ impl Painter {

// This might not be terribly performant. Testing it out
let is_reset = || match cursor::position() {
Ok(position) => position.1.abs_diff(self.prompt_start_row) > 1,
// when output something without newline, the cursor position is at current line.
// but the prompt_start_row is next line.
// in this case we don't want to reset, need to `add 1` to handle for such case.
Ok(position) => position.1 + 1 < self.prompt_start_row,

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

View check run for this annotation

Codecov / codecov/patch

src/painting/painter.rs#L159

Added line #L159 was not covered by tests
Err(_) => false,
};

Expand Down

0 comments on commit a621724

Please sign in to comment.