autocompletion: fix slice out of bounds access
Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
ca90343850
commit
27425c15c4
|
@ -70,6 +70,9 @@ func (ti *TextInput) String() string {
|
|||
}
|
||||
|
||||
func (ti *TextInput) StringLeft() string {
|
||||
for ti.index >= len(ti.text) {
|
||||
ti.index = len(ti.text) - 1
|
||||
}
|
||||
return string(ti.text[:ti.index])
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue