mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
fix: panic on completion for an alias (#12090)
This commit is contained in:
parent
cf8fcef9bf
commit
76d17abd5c
@ -186,13 +186,25 @@ impl Completer for CommandCompletion {
|
|||||||
|
|
||||||
// The last item here would be the earliest shape that could possible by part of this subcommand
|
// The last item here would be the earliest shape that could possible by part of this subcommand
|
||||||
let subcommands = if let Some(last) = last {
|
let subcommands = if let Some(last) = last {
|
||||||
self.complete_commands(
|
// we'll check if start of span is greater than offset, to prevent panic
|
||||||
working_set,
|
// else we can use the start and end values from last and use that.
|
||||||
Span::new(last.0.start, pos),
|
if last.0.start >= offset {
|
||||||
offset,
|
self.complete_commands(
|
||||||
false,
|
working_set,
|
||||||
options.match_algorithm,
|
Span::new(last.0.start, pos),
|
||||||
)
|
offset,
|
||||||
|
false,
|
||||||
|
options.match_algorithm,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
self.complete_commands(
|
||||||
|
working_set,
|
||||||
|
Span::new(last.0.start, last.0.end),
|
||||||
|
offset,
|
||||||
|
false,
|
||||||
|
options.match_algorithm,
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user