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:
Moritz Poldrack 2022-07-31 16:37:26 +02:00 committed by Robin Jarry
parent ca90343850
commit 27425c15c4

View file

@ -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])
}