juruen / rmapi

Go app that allows you to access your reMarkable tablet files through the Cloud API
GNU Affero General Public License v3.0
976 stars 106 forks source link

Autocomplete causes a crash. #150

Open m-abs opened 3 years ago

m-abs commented 3 years ago

Autocomplete causes a crash if the cursor is moved back...

ReMarkable Cloud API Shell
[/]>version
rmapi version: 0.0.13
[/]>mv R<tab> 
...
[/]>mv Readium/
... (moves cursor back to mv make a space write the first letter of a filename and press tab)
[/]>mv Q<tab> Readium/
...
[/]>mv Qpanic: runtime error: slice bounds out of range [-4:]

goroutine 52 [running]:
github.com/abiosoft/readline.(*RuneBuffer).RuneSlice(0xc0001259a0, 0xfffffffffffffff8, 0x0, 0x0, 0x0)
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/runebuf.go:115 +0x245
github.com/abiosoft/readline.(*opCompleter).CompleteRefresh(0xc0001c8000)
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/complete.go:201 +0x131
github.com/abiosoft/readline.(*opCompleter).EnterCompleteMode(...)
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/complete.go:271
github.com/abiosoft/readline.(*opCompleter).OnComplete(0xc0001c8000, 0xc0005d9d60)
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/complete.go:109 +0x217
github.com/abiosoft/readline.(*Operation).ioloop(0xc000166000)
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/operation.go:332 +0x5fc
created by github.com/abiosoft/readline.NewOperation
        /home/runner/go/pkg/mod/github.com/abiosoft/readline@v0.0.0-20180607040430-155bce2042db/operation.go:88 +0x2bd
spinus commented 3 years ago

on 0.0.13 I can reproduce this but only if I add additional space before writing, otherwise completion works and completes word in the middle.