There is a specific case when you delete the first character in select mode, library panics out: `> panic: runtime error: integer divide by zero [signal 0x8 code=0x7 addr=0x5958e pc=0x5958e] goroutine 6 [running]: panic(0x1306a0, 0xc82000a0b0) /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6 gopkg.in/readline%2ev1.(_opCompleter).doSelect(0xc820084080) /go/src/gopkg.in/readline.v1/complete.go:49 +0xee gopkg.in/readline%2ev1.(_opCompleter).OnComplete(0xc820084080) /go/src/gopkg.in/readline.v1/complete.go:72 +0x1e6 gopkg.in/readline%2ev1.(*Operation).ioloop(0xc820060300) /go/src/gopkg.in/readline.v1/operation.go:172 +0x1439 created by gopkg.in/readline%2ev1.NewOperation /go/src/gopkg.in/readline.v1/operation.go:67 +0x42a` Here is a gist of what I'm using to test this: https://gist.github.com/antekresic/283106411e826f53799fa4565e90f094 Steps to reproduce: press 's', Tab, Tab, Backspace Issue seems to be caused by entering OnComplete for an empty input rune buffer. My fix suggestion is to add a check for the empty buffer here: https://github.com/chzyer/readline/blob/master/complete.go#L69 Let me know if you want a PR. Thanks!
Activity
chzyer commentedon May 9, 2016
Nice catch, Thanks! And PR is welcome :)
[completer] Fixes issue chzyer#53
[completer] Fix bug which causes integer divide by zero panicking whe…
[completer] Fix bug which causes integer divide by zero panicking whe…