mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
Fix regression interpreting prompt y on multiline commandlines
Fixes a772470b76 (Multi-line autosuggestions, 2025-05-18)
Fixes #12121
This commit is contained in:
@@ -25,6 +25,7 @@ Regression fixes:
|
||||
-----------------
|
||||
- (from 4.1.0) Crash on invalid colors variables (:issue:`12078`).
|
||||
- (from 4.2.0) Incorrect emoji width computation on macOS.
|
||||
- (from 4.2.0) Mouse clicks and :kbd:`ctrl-l` edge cases in multiline commandlines (:issue:`12121`).
|
||||
|
||||
fish 4.2.1 (released November 13, 2025)
|
||||
=======================================
|
||||
|
||||
@@ -564,12 +564,10 @@ pub fn reset_line(&mut self, repaint_prompt: bool /* = false */) {
|
||||
}
|
||||
|
||||
pub fn push_to_scrollback(&mut self) {
|
||||
let Some(viewport_cursor_y) = self.viewport_y else {
|
||||
let Some(lines_to_scroll) = self.viewport_y else {
|
||||
return;
|
||||
};
|
||||
FLOG!(reader, "Pushing to scrollback");
|
||||
let lines_to_scroll = self.command_line_y_given_cursor_y(viewport_cursor_y);
|
||||
self.set_position_in_viewport("scrollback-push", Some(0));
|
||||
if lines_to_scroll == 0 {
|
||||
return;
|
||||
}
|
||||
@@ -578,6 +576,7 @@ pub fn push_to_scrollback(&mut self) {
|
||||
out.write_command(ScrollContentUp(lines_to_scroll));
|
||||
// Reposition cursor.
|
||||
out.write_command(CursorMove(CardinalDirection::Up, lines_to_scroll));
|
||||
self.set_position_in_viewport("scrollback-push", Some(0));
|
||||
}
|
||||
|
||||
pub fn set_position_in_viewport(&mut self, whence: &str, viewport_y: Option<usize>) {
|
||||
@@ -631,17 +630,16 @@ pub fn offset_in_cmdline_given_cursor(
|
||||
let Some(viewport_y) = self.viewport_y else {
|
||||
return CharOffset::None;
|
||||
};
|
||||
let viewport_prompt_y = self.command_line_y_given_cursor_y(viewport_y);
|
||||
let y = viewport_position
|
||||
.y
|
||||
.checked_sub(viewport_prompt_y)
|
||||
.checked_sub(viewport_y)
|
||||
.unwrap_or_else(|| {
|
||||
FLOG!(
|
||||
reader,
|
||||
"Given y",
|
||||
viewport_position.y,
|
||||
"exceeds the prompt's y",
|
||||
viewport_prompt_y,
|
||||
viewport_y,
|
||||
"inferred from reported cursor position",
|
||||
);
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user