mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 14:34:05 +00:00
Fix regression causing missing autosuggestions after (
Commit 4f3d6427ce
(Fix regression causing crash in "commandline -j",
2025-01-12) wasn't quite right; it mishandles the edge case where
the current process has no token, fix that.
This commit is contained in:
parent
c77c35152d
commit
24e216ae82
2 changed files with 13 additions and 8 deletions
|
@ -4650,16 +4650,15 @@ fn get_autosuggestion_performer(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Search history for a matching item unless this line is not a continuation line or quoted.
|
// Search history for a matching item unless this line is not a continuation line or quoted.
|
||||||
if {
|
let cursor_line_has_process_start = {
|
||||||
let mut tokens = vec![];
|
let mut tokens = vec![];
|
||||||
parse_util_process_extent(&command_line, cursor_pos, Some(&mut tokens));
|
parse_util_process_extent(&command_line, cursor_pos, Some(&mut tokens));
|
||||||
tokens
|
range_of_line_at_cursor(
|
||||||
.first()
|
&command_line,
|
||||||
.map(|tok| {
|
tokens.first().map(|tok| tok.offset()).unwrap_or(cursor_pos),
|
||||||
range_of_line_at_cursor(&command_line, tok.offset()) == search_string_range
|
) == search_string_range
|
||||||
})
|
};
|
||||||
.unwrap_or_default()
|
if cursor_line_has_process_start {
|
||||||
} {
|
|
||||||
let mut searcher = HistorySearch::new_with_type(
|
let mut searcher = HistorySearch::new_with_type(
|
||||||
history,
|
history,
|
||||||
search_string.to_owned(),
|
search_string.to_owned(),
|
||||||
|
|
|
@ -30,3 +30,9 @@ isolated-tmux send-keys A C-h
|
||||||
tmux-sleep
|
tmux-sleep
|
||||||
isolated-tmux capture-pane -p
|
isolated-tmux capture-pane -p
|
||||||
# CHECK: prompt 2> : ./COMPL
|
# CHECK: prompt 2> : ./COMPL
|
||||||
|
|
||||||
|
isolated-tmux send-keys C-u 'echo (echo)' Enter
|
||||||
|
isolated-tmux send-keys C-l 'echo ('
|
||||||
|
tmux-sleep
|
||||||
|
isolated-tmux capture-pane -p
|
||||||
|
# CHECK: prompt 3> echo (echo)
|
||||||
|
|
Loading…
Reference in a new issue