Skip to content

fix(tui): prevent dead keystrokes when spawning editor#4634

Closed
terakael wants to merge 1 commit into
anomalyco:devfrom
terakael:fix-tui-dead-keystrokes-clean
Closed

fix(tui): prevent dead keystrokes when spawning editor#4634
terakael wants to merge 1 commit into
anomalyco:devfrom
terakael:fix-tui-dead-keystrokes-clean

Conversation

@terakael

Copy link
Copy Markdown
Contributor

Summary

Fixes the issue where keystrokes become unresponsive after spawning an external editor from the TUI.

Changes

  • Remove stdin listeners before editor spawn to prevent OpenTUI from consuming keystrokes meant for the editor
  • Save and restore terminal settings with stty to maintain proper terminal state
  • Clear screen and reset cursor position to avoid rendering artifacts
  • Explicitly track and restore raw mode state for correct renderer behavior

Testing

  • Tested with various editors (vim, nano, etc.)
  • Verified terminal state is properly restored after editor exits
  • Confirmed no dead keystrokes after returning to TUI

Properly save and restore terminal state when launching external editor:
- Remove stdin listeners before editor spawn to prevent OpenTUI from consuming keystrokes
- Save terminal settings with stty and restore after editor exits
- Clear screen and reset cursor to avoid rendering artifacts
- Track raw mode state explicitly for correct renderer state management
@terakael
terakael force-pushed the fix-tui-dead-keystrokes-clean branch from e74eecf to 0d824bd Compare December 8, 2025 10:30
terakael pushed a commit to terakael/opencode that referenced this pull request Dec 11, 2025
- Add Editor.Result discriminated union type
- Move error checking into Editor.open() function
- Update session export and prompt handlers to use Result object
- Remove duplicate precondition checks from call sites
- Simplify error handling across both editor use cases

Builds on: fix-tui-dead-keystrokes-clean (PR anomalyco#4634)
@terakael terakael closed this Jan 12, 2026
@terakael

Copy link
Copy Markdown
Contributor Author

The dead keystrokes have been fixed in a different commit; this is no longer necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant