Skip to content

fix(tui): pause cursor blinking when unfocused - #91

Merged
Pepps233 merged 2 commits into
mainfrom
fix/tui-cursor-focus
Aug 17, 2026
Merged

Pepps233 merged 2 commits into
mainfrom
fix/tui-cursor-focus

Conversation

@Pepps233

Copy link
Copy Markdown
Contributor

Summary

Pause editor cursor blinking when the terminal window or pane is not focused.

Reasoning

Input activity cannot reliably indicate focus because an active user may be reading or waiting. The TUI now uses standard terminal focus reports and treats unavailable tmux focus reporting conservatively.

Changes

  • centralize terminal focus tracking for regular and fullscreen TUI renderers
  • stop placeholder cursor animation and hide the hardware cursor while unfocused
  • keep the software cursor static when tmux cannot report focus changes
  • preserve fullscreen selection cleanup on focus loss
  • document the tmux focus-events setting
  • add terminal, editor, renderer, and fallback regression coverage

User impact

The placeholder cursor blinks in focused terminals and panes, stays visible without animation when unfocused, and remains static when reliable focus reporting is unavailable. tmux users can enable focused-pane animation with set -g focus-events on.

Testing

  • npm run check
  • ./test.sh
  • cd packages/tui && node --test test/terminal.test.ts test/editor-placeholder-cursor.test.ts test/tui-focus.test.ts test/tui-alt-screen.test.ts

@Pepps233 Pepps233 self-assigned this Aug 16, 2026
@Pepps233
Pepps233 requested a review from Issacboy123 August 16, 2026 17:19

@Issacboy123 Issacboy123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR looks good to me, handles focus well in various terminals for the cursor to either be blinking or not.

@Pepps233
Pepps233 force-pushed the fix/tui-cursor-focus branch from 9008a45 to 2223ca5 Compare August 17, 2026 17:42
@Pepps233
Pepps233 force-pushed the fix/tui-cursor-focus branch from 1481e9b to c380afa Compare August 17, 2026 17:49
@Pepps233
Pepps233 merged commit 0d7facc into main Aug 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants