Repository navigation
fix(tui): Escape in Import Preview, and menus that forget their row after a sub-screen - #780
Merged
sirmalloc merged 9 commits intoNov 5, 2026
Conversation
…onfirmation When an import adds a Custom Command, choosing Replace All or Merge first asks "Apply this import? It adds a shell command...". Cancel says "Go back to the preview without importing", but coming back from Merge put the highlight on Replace All and switched the preview to the Replace diff. The confirmation doesn't name the mode, so pressing Enter again and confirming applied Replace All, which resets every setting the file leaves out to its default. The confirmation replaces the preview's List, and the List mounted again at its first row, then reported that row as the new selection. Mount it on the mode the preview was showing instead.
…rmation Escape did nothing on Import Preview, on both the diff and the "Apply this import? It adds a shell command..." confirmation. The only way out was to arrow down to Cancel and press Enter. The Import Config path dialog one step earlier, and the other menus, go back on Escape, and docs/USAGE.md already says Escape returns from the confirmation to the preview. The dialog had no input handler of its own, and its List only handles the arrows and Enter. Escape now steps back one screen: from the confirmation to the preview, where the mode stays highlighted, and from the preview out of the import, as Cancel does.
In Terminal Options you press Enter on Color Level to cycle through the levels. With an ansi256 or hex widget color, leaving 256 Color or Truecolor first warns "Custom colors detected!". After Yes, No or Escape the highlight was back on Terminal Width, so the next Enter opened the Terminal Width screen instead of cycling on. The warning replaces the List, and the List mounted again at its first row. Remember the highlighted row, as Powerline Setup does around its confirmations, and mount the List on it.
…Line Pressing Escape on a Refresh Interval or cache TTL prompt brought the list back with the highlight on the first row, Refresh Interval (or Git Cache TTL when Refresh Interval needs a newer Claude Code). Pressing Enter again opened a different setting from the one just left. Saving returns to the Main Menu, so only cancelling showed it. Each prompt replaces the List, and the List mounted again at its first row. Remember the highlighted row and mount the List on it.
… Install In Install to Claude Code, going back from the package manager step (Escape or "← Back") highlighted Pinned global install again, with its description, even after choosing Auto-update. Pressing Enter then led into the pinned global install commands instead of the npx/bunx ones. The style List mounts again on the way back, and it always started on its first row. Start it on the style still held from the first pick.
… of flexMode flexMode is going away with the Terminal Width options; any non-default key the import carries serves this fixture.
…he first row With sirmalloc#765 Terminal Options lists only Color Level, so the two tests start there instead of stepping down from Terminal Width.
…ade moot With sirmalloc#765, Color Level is Terminal Options' only setting and the custom-colors warning opens only from it, so the menu comes back on that row without help.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Import Preview ignored Escape, and three menus lost the highlighted row after coming back from a sub-screen:
Why (evidence)
docs/USAGE.mdalready says "Cancel/Escape to return to the preview", and the Import Config path dialog one step earlier goes back on Escape. The dialog had no input handler of its own, andListonly handles the arrows and Enter.onApply('replace').npm install -g/bun add -g. A confirmation still comes before anything installs.The last three share one cause. A sub-screen (a confirmation, a prompt or the next step) is drawn in place of the menu's
List. TheListunmounts, and when it mounts again it starts on its first row, becauseinitialSelectiondefaults to 0 or was hard-coded to 0. Powerline Setup and Line Selector already carry their selection across that remount.How
ImportPreviewDialog: auseInputfor Escape that goes back to the preview while the confirmation is open and callsonCancelotherwise. The mainListgetsinitialSelectionfrompreviewMode, which already tracks the highlighted mode for the diff.RefreshIntervalMenu: remembers the highlighted row throughonSelectionChangeand passes it back asinitialSelection, asPowerlineSetupdoes. The index counts selectable rows only, so it stays right when Refresh Interval is disabled.InstallMenu: the styleListstarts on theupdateStylestill held from the first pick instead of a hard-coded 0.Demo
Escape on Import Preview. Before the fix, two Escapes on the shell-command confirmation do nothing. After it, the first returns to the preview and the second to the Main Menu.
Powerline
Before:
After:
Plain
Before:
After:
Merge, then Cancel on the confirmation. Before the fix, the preview comes back on Replace All with the Replace diff. After it, the preview stays on Merge with the Merge diff.
Powerline
Before:
After:
Plain
Before:
After:
Configure Status Line after Escape on a TTL prompt. Before the fix, the highlight returns to Refresh Interval and Enter opens its prompt. After it, Custom Command Cache TTL stays highlighted.
Powerline
Before:
After:
Plain
Before:
After:
Install, back from the package manager step. Before the fix, Pinned global install is highlighted again. After it, Auto-update stays highlighted.
Powerline
Before:
After:
Plain
Before:
After:
Testing
mainas of fix: use env override and settings for usable context ratio calculation #407 (71e8b42): merges cleanly,bun run lintis clean, andbun testgives 3943 pass, 0 fail. The built CLI under Bun 1.4.4 and Node 26.13.0 matchesmainin plain and Powerline mode with the baseline configs, and the TUI opens and exits cleanly. It adds no JavaScript or Node API newer than Node 14, the build's target.mainunder both Bun and Node, and all pass here.bun test: 3175 pass, 0 fail, 178 files.main: 45/45.bun run lint: clean.dist/under Bun 1.4.2 and Node 26.10.0: plain and Powerline piped renders are identical across runtimes and matchmain. The TUI opens and exits cleanly on both.