mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-12 17:25:00 +08:00
Fix bad layout computation with right prompt
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
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
|
@ -1545,7 +1545,7 @@ impl<'a> Reader<'a> {
|
||||||
Cow::Owned(
|
Cow::Owned(
|
||||||
wstr::from_char_slice(&[get_obfuscation_read_char()]).repeat(cmd_line.len()),
|
wstr::from_char_slice(&[get_obfuscation_read_char()]).repeat(cmd_line.len()),
|
||||||
),
|
),
|
||||||
0..0,
|
None,
|
||||||
)
|
)
|
||||||
} else if self.is_at_line_with_autosuggestion() {
|
} else if self.is_at_line_with_autosuggestion() {
|
||||||
// Combine the command and autosuggestion into one string.
|
// Combine the command and autosuggestion into one string.
|
||||||
|
@ -1559,11 +1559,12 @@ impl<'a> Reader<'a> {
|
||||||
autosuggestion.search_string_range.clone(),
|
autosuggestion.search_string_range.clone(),
|
||||||
&autosuggestion.text,
|
&autosuggestion.text,
|
||||||
)),
|
)),
|
||||||
autosuggested_start..autosuggested_end,
|
Some(autosuggested_start..autosuggested_end),
|
||||||
)
|
)
|
||||||
} else {
|
} 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.
|
// Copy the colors and insert the autosuggestion color.
|
||||||
let data = &self.data.rendered_layout;
|
let data = &self.data.rendered_layout;
|
||||||
|
|
|
@ -11,7 +11,7 @@ tmux-sleep
|
||||||
isolated-tmux capture-pane -p
|
isolated-tmux capture-pane -p
|
||||||
# CHECK: prompt 1> echo foobar|cat
|
# 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
|
tmux-sleep
|
||||||
isolated-tmux capture-pane -p
|
isolated-tmux capture-pane -p
|
||||||
# CHECK: 2
|
# CHECK: 2
|
||||||
|
@ -24,3 +24,19 @@ isolated-tmux capture-pane -p
|
||||||
# CHECK: 9
|
# CHECK: 9
|
||||||
# CHECK: 10
|
# CHECK: 10
|
||||||
# CHECK: scroll_here
|
# 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 New Issue
Block a user