From e7ad7e5cf637640214b82d51886448dccb35b340 Mon Sep 17 00:00:00 2001 From: kerty Date: Sun, 19 Oct 2025 19:07:25 +0300 Subject: [PATCH] Fix missing right prompt when left prompt ends with empty line Reproduction: fish -C ' function fish_prompt echo left-prompt\n end function fish_right_prompt echo right-prompt end ' This was caused by an off-by-one error in initial Screen.desired resizing from commit 606802daa (Make ScreenData track multiline prompt, 2025-10-15). --- src/screen.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/screen.rs b/src/screen.rs index 54cc468db..56aa23e2d 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -358,7 +358,7 @@ struct ScrolledCursor { self.desired.cursor.y = layout.left_prompt_lines - 1; self.desired.clear_lines(); - self.desired.resize(self.desired.cursor.y); + self.desired.resize(layout.left_prompt_lines); // Append spaces for the left prompt. let prompt_offset = if pager.search_field_shown { @@ -452,12 +452,11 @@ struct ScrolledCursor { }; // Add an empty line if there are no lines or if the last line was soft wrapped (but not by autosuggestion). - if self.desired.line_datas.last().is_none_or(|line| { - line.len() == screen_width - && (commandline.is_empty() - || autosuggestion.is_empty() - || !explicit_after_suggestion.is_empty()) - }) { + if self.desired.line_datas.last().unwrap().len() == screen_width + && (commandline.is_empty() + || autosuggestion.is_empty() + || !explicit_after_suggestion.is_empty()) + { self.desired.add_line(); }