diff options
| author | Dax Raad <[email protected]> | 2025-06-28 11:56:47 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-06-28 11:56:47 -0400 |
| commit | 322385f6b14338760ce87223685169c38332d3bd (patch) | |
| tree | a8bef9e2a49cccfae6d3df9c941ea8f19d3e2a52 | |
| parent | b7446cd7b9a5628258df3385894032d842b373e3 (diff) | |
| download | opencode-322385f6b14338760ce87223685169c38332d3bd.tar.gz opencode-322385f6b14338760ce87223685169c38332d3bd.zip | |
patch for scroll dumping characters into input buffer
| -rw-r--r-- | packages/tui/internal/tui/tui.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go index 89a34e351..6dde8da16 100644 --- a/packages/tui/internal/tui/tui.go +++ b/packages/tui/internal/tui/tui.go @@ -56,6 +56,7 @@ type appModel struct { isLeaderSequence bool toastManager *toast.ToastManager interruptKeyState InterruptKeyState + lastScroll time.Time } func (a appModel) Init() tea.Cmd { @@ -81,12 +82,32 @@ func (a appModel) Init() tea.Cmd { return tea.Batch(cmds...) } +var BUGGED_SCROLL_KEYS = map[string]bool{ + "0": true, + "1": true, + "2": true, + "3": true, + "4": true, + "5": true, + "6": true, + "7": true, + "8": true, + "9": true, + "M": true, + "m": true, + "[": true, + ";": true, +} + func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmds []tea.Cmd switch msg := msg.(type) { case tea.KeyPressMsg: keyString := msg.String() + if time.Since(a.lastScroll) < time.Millisecond*100 && BUGGED_SCROLL_KEYS[keyString] { + return a, nil + } // 1. Handle active modal if a.modal != nil { @@ -222,6 +243,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { a.editor = updatedEditor.(chat.EditorComponent) return a, cmd case tea.MouseWheelMsg: + a.lastScroll = time.Now() if a.modal != nil { return a, nil } |
