maaslalani / draw

Draw in your terminal
MIT License
460 stars 18 forks source link

Draw panics with index out of range error in MacOS Terminal app. #17

Open jhr22 opened 1 year ago

jhr22 commented 1 year ago

Describe the bug Draw panics with index out of range error in MacOS Terminal app.

This only happens for me when dragging off the screen to the right.

To Reproduce Steps to reproduce the behavior:

  1. Open Terminal app on MacOS
  2. Left click in hold in the middle of the screen
  3. Drag to the right
  4. See panic

Expected behavior Expected draw not to panic (do not allow index out of range)

Screenshots

Up, down, left okay, right not okay.

Screenshot 2023-06-19 at 13 53 40

Desktop (please complete the following information):

Additional context

Caught panic:

runtime error: index out of range [90] with length 90

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
    /opt/homebrew/Cellar/go/1.20.4/libexec/src/runtime/debug/stack.go:24 +0x64
runtime/debug.PrintStack()
    /opt/homebrew/Cellar/go/1.20.4/libexec/src/runtime/debug/stack.go:16 +0x1c
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func3()
    /Users/jhr22/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.20.0/tea.go:359 +0x8c
panic({0x104f5d600, 0x1400001a0a8})
    /opt/homebrew/Cellar/go/1.20.4/libexec/src/runtime/panic.go:890 +0x258
main.(*model).Update(0x14000146080, {0x104f5cc60?, 0x140000a8620?})
    /Users/jhr22/go/pkg/mod/github.com/maaslalani/draw@v0.1.1/draw.go:65 +0xfe4
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel(0x14000146100)
    /Users/jhr22/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.20.0/tea.go:547 +0xf70
github.com/charmbracelet/bubbletea.(*Program).Start(...)
    /Users/jhr22/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.20.0/tea.go:556
main.main()
    /Users/jhr22/go/pkg/mod/github.com/maaslalani/draw@v0.1.1/main.go:21 +0x64