return empty completion lines on unsupported `COMP_POINT` (#76)
When `COMP_POINT` is invalid or out of range, return an empty list of completions instead of raising `ValueError`. This matches behaviour for `comp_point < 0 or comp_point > len(comp_line)` cases.
This commit is contained in:
parent
d0d6fb45b2
commit
c67257660b
|
@ -120,7 +120,11 @@ proc getTok(l: var ShellLexer): Option[string] =
|
|||
|
||||
proc splitCompletionLine*(): seq[string] =
|
||||
let comp_line = os.getEnv("COMP_LINE")
|
||||
var comp_point = parseInt(os.getEnv("COMP_POINT", "0"))
|
||||
var comp_point =
|
||||
try:
|
||||
parseInt(os.getEnv("COMP_POINT", "0"))
|
||||
except ValueError:
|
||||
return @[]
|
||||
|
||||
if comp_point == len(comp_line):
|
||||
comp_point -= 1
|
||||
|
|
Loading…
Reference in New Issue