mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-11 20:48:49 +00:00
Fix bad layout computation with right prompt
Commit 1c4e5cadf2
(Autosuggestions in multi-line
command lines, 2024-12-15) accidentally passed an empty
"commandline_before_suggestion" to compute_layout() when there is
no autosuggestion.
Closes #10996
This commit is contained in:
parent
e49dde87cc
commit
e11e62674f
2 changed files with 21 additions and 4 deletions
|
@ -1545,7 +1545,7 @@ impl<'a> Reader<'a> {
|
|||
Cow::Owned(
|
||||
wstr::from_char_slice(&[get_obfuscation_read_char()]).repeat(cmd_line.len()),
|
||||
),
|
||||
0..0,
|
||||
None,
|
||||
)
|
||||
} else if self.is_at_line_with_autosuggestion() {
|
||||
// Combine the command and autosuggestion into one string.
|
||||
|
@ -1559,11 +1559,12 @@ impl<'a> Reader<'a> {
|
|||
autosuggestion.search_string_range.clone(),
|
||||
&autosuggestion.text,
|
||||
)),
|
||||
autosuggested_start..autosuggested_end,
|
||||
Some(autosuggested_start..autosuggested_end),
|
||||
)
|
||||
} else {
|
||||
(Cow::Borrowed(cmd_line.text()), 0..0)
|
||||
(Cow::Borrowed(cmd_line.text()), None)
|
||||
};
|
||||
let autosuggested_range = autosuggested_range.unwrap_or(full_line.len()..full_line.len());
|
||||
|
||||
// Copy the colors and insert the autosuggestion color.
|
||||
let data = &self.data.rendered_layout;
|
||||
|
|
|
@ -11,7 +11,7 @@ tmux-sleep
|
|||
isolated-tmux capture-pane -p
|
||||
# CHECK: prompt 1> echo foobar|cat
|
||||
|
||||
isolated-tmux send-keys C-k C-u C-l 'commandline -i (seq $LINES) scroll_here' Enter
|
||||
isolated-tmux send-keys C-k C-u C-l 'commandline -i "\'$(seq $LINES)" scroll_here' Enter
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p
|
||||
# CHECK: 2
|
||||
|
@ -24,3 +24,19 @@ isolated-tmux capture-pane -p
|
|||
# CHECK: 9
|
||||
# CHECK: 10
|
||||
# CHECK: scroll_here
|
||||
|
||||
# Soft-wrapped commandline with omitted right prompt.
|
||||
isolated-tmux send-keys C-c
|
||||
tmux-sleep
|
||||
isolated-tmux send-keys C-l '
|
||||
function fish_right_prompt
|
||||
echo right-prompt
|
||||
end
|
||||
commandline -i "echo $(printf %0"$COLUMNS"d)"
|
||||
' Enter
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p | sed 1,5d
|
||||
# CHECK: prompt 4> echo 00000000000000000000000000000000000000000000000000000000000000000
|
||||
# CHECK: 000000000000000
|
||||
# CHECK: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
# CHECK: prompt 5> right-prompt
|
||||
|
|
Loading…
Reference in a new issue