tui: real terminal cursor in composer + window title (v2)
Two v2-unlocked polish items now that the TUI is on bubbletea v2: Native cursor — the composer caret was a frame-animated "▏" that forced the redraw loop to keep ticking in insert mode. v2's View.Cursor lets the terminal draw and blink a real cursor, so: - editorLines/launcherInput drop a width-1 marker rune (U+E123, same cell width as "▏") at the caret; View() locates it in the fully-composited frame via splitCursor → (X,Y), swaps it for a space, and sets a blinking CursorBar there. - render() (preview/golden tests) resolves the marker to the static "▏" glyph, so screenshots are unchanged and the marker never leaks into output. - nil cursor in normal mode hides it (vim-correct); gated on overlay==None so an open palette/files modal (which keeps editMode==Insert) doesn't draw a cursor behind it. - animating() no longer forces a redraw in insert mode — the terminal blinks the cursor itself, so an idle insert screen holds still (native text selection survives) and burns no frames. Window title — View.WindowTitle names the terminal tab after the active session, falling back to the model name then "correx". Tests: new cursor_test.go (coord extraction, mode/overlay gating, no marker leak); updated the animating-gate test for the new insert-mode contract. Build, vet, gofmt, full suite green; compose preview shows the static caret with no marker leak. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,10 @@ func (m Model) Init() tea.Cmd {
|
||||
// When false, the tick loop stops and the screen holds still — so a native terminal
|
||||
// text selection survives instead of being wiped by the next redraw.
|
||||
func (m Model) animating() bool {
|
||||
if m.editMode == ModeInsert || m.steering || m.clarTyping || m.proposeTyping || m.configEditing {
|
||||
// Note: ModeInsert is intentionally NOT here — the composer caret is now a real
|
||||
// terminal cursor (View.Cursor) that the terminal blinks itself, so insert mode no
|
||||
// longer needs the frame loop. The other typing surfaces keep their drawn carets.
|
||||
if m.steering || m.clarTyping || m.proposeTyping || m.configEditing {
|
||||
return true
|
||||
}
|
||||
if m.reconnecting {
|
||||
|
||||
Reference in New Issue
Block a user