Skip to content

cmdio: decode keys through teainput - #7740

Draft
pietern wants to merge 1 commit into
pietern/charm-v2/03a-render-splitfrom
pietern/charm-v2/03b-teainput
Draft

pietern wants to merge 1 commit into
pietern/charm-v2/03a-render-splitfrom
pietern/charm-v2/03b-teainput

Conversation

@pietern

@pietern pietern commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Prompt, select and the pager switch on keystroke names from a new libs/cmdio/teainput package instead of v1 key types:

  • teainput.Decode turns a bubbletea message into an Event with Key (keystroke name), Text (printable text) and Paste. Key names follow bubbletea v2 (enter, ctrl+c, space, alt+backspace).
  • Several runes in one read are text and get no key name. A single rune is a key press.
  • Alt is kept in the name only where v1 checked it: Alt+rune, Alt+space, Alt+backspace and Alt+tab. Other Alt combinations act as the plain key, as in v1. Alt+Space still advances the pager, as in v1.
  • A paste is handled as v1 handled it: the prompt inserts it, select treats it as typed text, the pager ignores it.

Why

This is v1 behaviour on the new decoder, so the v2 move only changes the decoder. Fixed on the way: a burst of text that spells a key name (enter, down) used to act as that key. v1 typed it as text; the decoder had given it the key's name, so a fast enter submitted a prompt. Now a burst is text.

Tests

  • go build ./..., golangci-lint (0 issues), gofmt clean.
  • TERM=xterm-256color go test -race -count=3 ./libs/cmdio/... passes.
  • New teainput tests cover the decoder, including bursts (enter, down, ctrl+c) and paste.
  • The existing burst pins (TestKeysPin_PromptBurstKeyName, TestKeysPin_SelectFilterBurstKeyName) pass with the same text as v1.
  • The pins pass without -update. No golden changes.

Stack: based on pietern/charm-v2/03a-render-split.

Manual checks for real terminals:

  • databricks selftest tui prompt, then type enter quickly (or paste it) and press Enter: Entered: enter (v1 and this branch).

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: abd2eff

Run: 44310848996

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 19 19:50
💚​ aws-windows-latest-4core-16gb 1 274 17 16:27
💚​ azure linux-2core-8gb 1 271 19 15:44
💚​ azure-windows-latest-4core-16gb 1 273 17 11:28
💚​ gcp linux-2core-8gb 1 272 19 13:06
💚​ gcp-windows-latest-4core-16gb 1 274 17 10:21
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 37 slowest tests (at least 2 minutes):
duration env testname
5:40 aws-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
5:05 aws-windows-latest-4core-16gb TestImportDir
4:55 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
4:47 aws linux-2core-8gb TestSyncIncrementalFileSync
3:41 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
3:38 azure-windows-latest-4core-16gb TestAccept
3:28 aws-windows-latest-4core-16gb TestAccept
3:28 azure-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
3:21 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
3:16 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files
3:11 gcp-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
3:08 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsRead
3:05 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
3:05 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
3:02 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
3:02 gcp-windows-latest-4core-16gb TestAccept
2:58 gcp-windows-latest-4core-16gb TestImportDir
2:54 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:50 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
2:45 azure linux-2core-8gb TestSyncIncrementalFileSync
2:45 azure linux-2core-8gb TestSyncFullFileSync
2:42 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:39 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsRead
2:37 aws-windows-latest-4core-16gb TestSyncFullFileSync
2:36 azure linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:34 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:33 azure-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files_extensions
2:30 gcp-windows-latest-4core-16gb TestFilerReadWrite/workspace_files_extensions
2:28 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:26 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsRead
2:26 azure-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
2:20 azure-windows-latest-4core-16gb TestExportDir
2:18 gcp linux-2core-8gb TestExportDir
2:15 aws-windows-latest-4core-16gb TestFilerReadDir/workspace_files
2:15 azure-windows-latest-4core-16gb TestSyncIncrementalSyncFileToPythonNotebook
2:02 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:01 aws linux-2core-8gb TestFilerReadWrite/workspace_files_extensions

@pietern
pietern added this pull request to stack #7754 November 18, 2026 08:35
@pietern

pietern commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/review

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — no issues found.

@pietern
pietern force-pushed the pietern/charm-v2/03b-teainput branch from 786e293 to abd2eff Compare November 18, 2026 13:07
@pietern
pietern force-pushed the pietern/charm-v2/03b-teainput branch from abd2eff to 6faf163 Compare November 18, 2026 15:55
Models switch on keystroke names from teainput.Decode instead of v1
key types. Behaviour is v1's, with one fix: several runes arriving in
one read are text and carry no key name, so typing "enter" fast no
longer submits a prompt. A single rune is still a key press.

Alt is kept in the name only where v1 checked it: Alt+rune, Alt+space,
Alt+backspace and Alt+tab stay inert, and Alt+space still advances the
pager. Other Alt combinations act as the plain key, as in v1. A paste is
handled as v1 handled it: prompt inserts it, select treats it as typed
text, and the pager ignores it.

The existing burst pins (prompt "enter", select "down") and the new
teainput tests pin the text. No golden moves.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern
pietern force-pushed the pietern/charm-v2/03b-teainput branch from 6faf163 to bc4d7d7 Compare November 18, 2026 16:07

This branch has not been deployed

No deployments
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.

2 participants