-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic: runtime error: slice bounds out of range #110
Comments
@Shreyas165 Thanks for reporting. Could you update issue description to follow the format of issue template? At least, I need to know the context information about your operating system, terminal emulator and the revision of go-prompt. |
Operating System: Mac OS 10.13 The sample test case which was used when the issue occurred : run the above test in a golang editor or probably gotest will result in the above mentioned panic |
Thanks. Could you rewrite the issue description in following format? |
@c-bata I fixed a similar issue using:
|
I am getting the same error when trying to bind a Shortcut key to insert text into the prompt buffer.
|
go-prompt/buffer.go
Line 52 in 63e3a6f
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range
goroutine 6 [running]:
testing.tRunner.func1(0xc0000aa300)
/usr/local/go/src/testing/testing.go:792 +0x387
panic(0x111bb00, 0x122e800)
/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/c-bata/go-prompt.(*Buffer).InsertText(0xc000040760, 0x11417e9, 0x3, 0x1050101)
vendor/github.com/c-bata/go-prompt/buffer.go:52 +0x43d
sample code used :
func TestCLIPrompt_Completer(t *testing.T) {
buffer := goPrompt.NewBuffer()
buffer.InsertText("one", true, true) // this results in the panic
fmt.Println(buffer.Document())
buffer.CursorRight(2)
fmt.Println(buffer.Document())
}
The text was updated successfully, but these errors were encountered: