Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fix prompt_start_row reset to 0 when opening a file without newline in Nushell #697

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

// 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