-
Notifications
You must be signed in to change notification settings - Fork 11
All interactive prompts re-render label repeatedly on arrow navigation (cursor not reset, UI corruption) #6
Description
All interactive prompts that rely on arrow key navigation are breaking the terminal UI after the first key press.
This affects:
- AskChoice
- AskMultiChoice
- AskWithOptions
- AutoComplete
The initial render is correct.
However, once arrow navigation begins, the label is re-printed repeatedly across the same line without resetting the cursor position, causing severe UI corruption.
Exact Behavior
Initial render (correct):
? Select framework:
(↑/↓ navigate, Enter select, Esc cancel)
→ React
Vue
Angular
Svelte
After pressing arrow keys:
? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
? Select framework: ? Select framework:
(↑/↓ navigate, Enter select, Esc cancel)
→ React
Vue
Angular
Svelte
The label is printed multiple times horizontally across the terminal.
The options list also becomes misaligned and visually broken.
Expected Behavior
The prompt should render once
On arrow navigation, the UI should update in place
The cursor should reset to column 0 before redraw
Previous lines should be cleared properly
No duplicated labels
Technical Observation
This appears to be a render loop issue where:
The cursor is not returned to column 0 before redraw
Previous lines are not cleared (\033[K)
The renderer may not be using proper ANSI cursor controls (\r, \033[F, etc.)
The header is printed again instead of being re-drawn in place
It looks like each key event triggers a full re-print without terminal state reset.
Minimal Reproduction
frameworks := []string{"React", "Vue", "Angular", "Svelte"}
choice, err := clime.AskChoice("Select framework:", frameworks...)
The same issue occurs with:
clime.AskMultiChoice(...)
clime.AskWithOptions(...)
clime.AutoComplete(...)