Skip to content

fix(tui): support pasting into text inputs - #54

Merged
jp2195 merged 1 commit into
mainfrom
fix/paste-support
Aug 5, 2026
Merged

fix(tui): support pasting into text inputs#54
jp2195 merged 1 commit into
mainfrom
fix/paste-support

Conversation

@jp2195

@jp2195 jp2195 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Problem

Bracketed paste was never handled. The top-level Update matched only KeyPressMsg, so tea.PasteMsg fell through to handleDataMsg and was logged as an unhandled message and dropped — nothing in the app accepted pasted text.

The login form was the worst of it: a password could not be pasted in at all.

Fix

bubbles' textinput already handles tea.PasteMsg, so routing is enough.

  • Split updateCurrentView out of handleViewKeys so non-key messages reach the same views without being retyped as key presses.
  • Forward paste to the login form, connection form and command palette.
  • Table views accept paste only while their filter input is focused — otherwise pasted text would be read as a burst of navigation keys.
  • The login form stays frozen while a keygen is in flight, matching the existing key handling.
  • PasteStartMsg/PasteEndMsg are matched as no-ops so the bracketing markers don't trip the unhandled-message warning.

Verification

Reproduced and verified against a live PA-440 (PAN-OS 11.2.10-h8) by driving the TUI under a pty and sending a real ESC[200~ … ESC[201~ sequence:

  • Before: password field stayed on its placeholder, zero characters entered.
  • After: field shows 8 masked characters and the pasted password authenticates successfully.

Unit tests cover paste into each login field and that pasting is ignored while authenticating.

gofmt, go vet, golangci-lint (0 issues) and go test -race ./... all clean.

Bracketed paste was never handled. The top-level Update matched only
KeyPressMsg, so tea.PasteMsg fell through to handleDataMsg and was
logged as an unhandled message and dropped — nothing in the app accepted
pasted text. Most painfully the login form, where a password could not
be pasted in at all.

bubbles' textinput already handles tea.PasteMsg, so routing is enough.
Split updateCurrentView out of handleViewKeys so non-key messages reach
the same views without being retyped as key presses, and forward paste
to the login form, the connection form and the command palette. Table
views take paste only while their filter input is focused, otherwise
pasted text would be read as a burst of navigation keys. The login form
stays frozen while a keygen is in flight, matching the key handling.

PasteStartMsg/PasteEndMsg are matched as no-ops so the bracketing
markers don't trip the unhandled-message warning.
@github-actions github-actions Bot added the tui label Aug 4, 2026
@jp2195
jp2195 merged commit 5601c0a into main Aug 5, 2026
14 checks passed
@jp2195
jp2195 deleted the fix/paste-support branch August 5, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant