[GH-ISSUE #592] Keyboard input randomly dropped during typing and navigation #161

Closed
opened 2026-03-02 23:44:59 +03:00 by kerem · 1 comment
Owner

Originally created by @Gijuno on GitHub (Jan 26, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/592

Keyboard input randomly dropped during typing and navigation

Environment

  • OpenCode: 1.1.36
  • OpenTUI: 0.1.74
  • OS: macOS 26.2 Tahoe (Apple Silicon)
  • Terminals tested: iTerm, Ghostty, Terminal.app (all affected)
  • Fresh reinstall: Yes, issue persists

Description

When typing in textarea or navigating with arrow keys, input is randomly dropped/ignored.

Text input:

  • Input: "hello" → Display: "ello" or "hllo" (random chars missing)
  • Fast typing causes more frequent drops

Arrow keys:

  • Left/right arrow keys are also randomly ignored during navigation

Ctrl+C:

  • Cancel/interrupt action is also randomly ignored
  • Sometimes requires multiple presses to register

Root Cause Analysis

Debug logs (OTUI_DEBUG=1) show full screen repaint on every single keystroke:

[?25l              ← cursor hide
[6;55H...         ← logo area repaint
[7;22H█▀▀█...     ← logo repaint
[8;22H...         ← logo repaint
[9;22H...         ← logo repaint
[13;7H...         ← actual text area
[?25h             ← cursor show

The entire screen (including static elements like the logo) is being repainted on every keypress. This appears to block stdin event processing, causing subsequent keypresses to be dropped.

Reproduction

  1. Run any OpenTUI app with a textarea (e.g., opencode)
  2. Type quickly in the input field
  3. Observe missing characters
  4. Try rapid arrow key navigation - some keypresses are ignored
  5. Try Ctrl+C during operation - often ignored

Expected Behavior

  • All keystrokes should be captured and processed
  • Static UI elements should not repaint on every keystroke (dirty region optimization)
  • Ctrl+C should always be responsive

Workarounds Attempted

  • Disabled animations (animations_enabled: false) - no effect
  • Tested multiple terminals - all affected
  • Fresh reinstall - no effect

Suggested Fix

  1. Implement dirty region tracking - only repaint changed areas
  2. Decouple stdin processing from render loop
  3. Buffer keyboard events during render
Originally created by @Gijuno on GitHub (Jan 26, 2026). Original GitHub issue: https://github.com/anomalyco/opentui/issues/592 # Keyboard input randomly dropped during typing and navigation ## Environment - OpenCode: 1.1.36 - OpenTUI: 0.1.74 - OS: macOS 26.2 Tahoe (Apple Silicon) - Terminals tested: iTerm, Ghostty, Terminal.app (all affected) - Fresh reinstall: Yes, issue persists ## Description When typing in textarea or navigating with arrow keys, input is **randomly dropped/ignored**. ### Text input: - Input: "hello" → Display: "ello" or "hllo" (random chars missing) - Fast typing causes more frequent drops ### Arrow keys: - Left/right arrow keys are also randomly ignored during navigation ### Ctrl+C: - Cancel/interrupt action is also randomly ignored - Sometimes requires multiple presses to register ## Root Cause Analysis Debug logs (`OTUI_DEBUG=1`) show **full screen repaint on every single keystroke**: ``` [?25l ← cursor hide [6;55H... ← logo area repaint [7;22H█▀▀█... ← logo repaint [8;22H... ← logo repaint [9;22H... ← logo repaint [13;7H... ← actual text area [?25h ← cursor show ``` The entire screen (including static elements like the logo) is being repainted on every keypress. This appears to block stdin event processing, causing subsequent keypresses to be dropped. ## Reproduction 1. Run any OpenTUI app with a textarea (e.g., `opencode`) 2. Type quickly in the input field 3. Observe missing characters 4. Try rapid arrow key navigation - some keypresses are ignored 5. Try Ctrl+C during operation - often ignored ## Expected Behavior - All keystrokes should be captured and processed - Static UI elements should not repaint on every keystroke (dirty region optimization) - Ctrl+C should always be responsive ## Workarounds Attempted - Disabled animations (`animations_enabled: false`) - no effect - Tested multiple terminals - all affected - Fresh reinstall - no effect ## Suggested Fix 1. Implement dirty region tracking - only repaint changed areas 2. Decouple stdin processing from render loop 3. Buffer keyboard events during render
kerem closed this issue 2026-03-02 23:44:59 +03:00
Author
Owner

@Gijuno commented on GitHub (Jan 26, 2026):

Closing - this was a local environment issue caused by a misconfigured MCP plugin (loaded as a plugin instead of MCP server, causing stdin conflict). Not an OpenTUI bug.

<!-- gh-comment-id:3800390376 --> @Gijuno commented on GitHub (Jan 26, 2026): Closing - this was a local environment issue caused by a misconfigured MCP plugin (loaded as a plugin instead of MCP server, causing stdin conflict). Not an OpenTUI bug.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#161
No description provided.