Skip to content

fix(tui): paste support and stray-t placeholder fix - #299

Merged
MichaelSp merged 2 commits into
mainfrom
fix/tui-paste-and-stray-t
Sep 23, 2026
Merged

MichaelSp merged 2 commits into
mainfrom
fix/tui-paste-and-stray-t

Conversation

@MichaelSp

Copy link
Copy Markdown
Owner

Problem

Two bugs in the search-as-you-type bar:

1. CMD+V paste did nothing

tea.PasteMsg (the bracketed-paste event terminals emit on CMD+V / paste) was never handled in Model.Update. It fell through to return m, nil and was silently dropped.

2. Stray t when search expression is empty

bubbles/v2 placeholderView() renders the first rune of the placeholder (t from "type to filter...") as a virtualCursor character. In terminals that fall back to printing the cursor char as text, this appeared as a literal t prefix on the input line.

Fix

Paste — added case tea.PasteMsg in Model.Update that forwards to m.input.Update and re-filters the list. Same fix for listModel.

Stray t — cleared the textinput Placeholder and instead appended a dim "type to filter..." hint after m.input.View() only when the query is empty, rendering it as plain styled text (no cursor-char tricks).

Tests

7 new unit tests in pkg/tui/model_test.go covering:

  • TestNoStrayT_EmptyQuery — input line must not start with t
  • TestHintTextAppended_EmptyQuery — hint appears when query is empty
  • TestHintTextGone_NonEmptyQuery — hint disappears once user types
  • TestPasteMsg_UpdatesQuery — paste sets the query
  • TestPasteMsg_TriggersRefilter — paste re-filters the list
  • TestPasteMsg_EmptyContent — empty paste is a no-op
  • TestPasteMsg_AppendsToExistingQuery — paste appends to existing typed text

Two bugs in the search-as-you-type bar:

1. Paste (CMD+V / bracketed paste):
   Model.Update never handled tea.PasteMsg (the event terminals emit
   on CMD+V when bracketed-paste mode is active), so the message fell
   through to return m, nil and was silently dropped.
   Fix: add an explicit case tea.PasteMsg that forwards to
   m.input.Update and re-filters the list.

2. Stray 't' when search expression is empty:
   bubbles/v2 placeholderView() renders the first rune of the
   placeholder ('t' from "type to filter...") as a virtualCursor
   character. In terminals that fall back to printing the cursor char
   as text this appeared as a literal 't' prefix on the input line.
   Fix: clear the textinput Placeholder and instead append a dim
   "type to filter..." hint *after* m.input.View() only when the
   query is empty, rendering it as plain styled text.

Both fixes apply to Model (main switcher TUI) and listModel (RunList).
7 new unit tests cover both bugs and key edge-cases.

Signed-off-by: Michael Sprauer <Michael.Sprauer@sap.com>
Signed-off-by: Michael Sprauer <Michael.Sprauer@sap.com>
@MichaelSp
MichaelSp merged commit 330087e into main Sep 23, 2026
5 checks passed
@MichaelSp
MichaelSp deleted the fix/tui-paste-and-stray-t branch September 23, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant