mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-25 19:25:06 +00:00
Demote logs about unexpected cursor position
As reported in https://github.com/fish-shell/fish-shell/issues/10992#issuecomment-2568954940, the user may reset the terminal and run scrollback-push without repainting in between. This means that the terminal will report the cursor position y=0 x=0 which doesn't match what fish renders. Fortunately, y=0 is a safe fallback value for the scrollback-push use case. While at it, fix an off-by-one error in a log.
This commit is contained in:
parent
870a8f77a0
commit
996fec87f4
1 changed files with 5 additions and 5 deletions
|
@ -504,12 +504,12 @@ impl Screen {
|
|||
|
||||
pub fn push_to_scrollback(&mut self, cursor_y: usize) {
|
||||
let prompt_y = self.command_line_y_given_cursor_y(cursor_y);
|
||||
let trailing_prompt_lines = calc_prompt_lines(&self.actual_left_prompt);
|
||||
let trailing_prompt_lines = calc_prompt_lines(&self.actual_left_prompt) - 1;
|
||||
let lines_to_scroll = prompt_y
|
||||
.checked_sub(trailing_prompt_lines - 1)
|
||||
.checked_sub(trailing_prompt_lines)
|
||||
.unwrap_or_else(|| {
|
||||
FLOG!(
|
||||
error,
|
||||
reader,
|
||||
"Number of trailing prompt lines prompt lines",
|
||||
trailing_prompt_lines,
|
||||
"exceeds prompt's y",
|
||||
|
@ -539,7 +539,7 @@ impl Screen {
|
|||
let prompt_y = viewport_cursor_y.checked_sub(self.actual.cursor.y);
|
||||
prompt_y.unwrap_or_else(|| {
|
||||
FLOG!(
|
||||
error,
|
||||
reader,
|
||||
"Reported cursor line index",
|
||||
viewport_cursor_y,
|
||||
"is above fish's cursor",
|
||||
|
@ -560,7 +560,7 @@ impl Screen {
|
|||
.checked_sub(viewport_prompt_y)
|
||||
.unwrap_or_else(|| {
|
||||
FLOG!(
|
||||
error,
|
||||
reader,
|
||||
"Given y",
|
||||
viewport_position.y,
|
||||
"exceeds the prompt's y",
|
||||
|
|
Loading…
Reference in a new issue