Skip to content

fix(desktop): preserve TUI state when switching terminal tabs#668

Merged
Kitenite merged 2 commits intomainfrom
improve-addon
Jan 8, 2026
Merged

fix(desktop): preserve TUI state when switching terminal tabs#668
Kitenite merged 2 commits intomainfrom
improve-addon

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 8, 2026

Summary

  • Include alternate screen buffer in terminal serialization so TUI apps restore their display when switching tabs
  • Preserve terminal modes (alt screen, cursor visibility, mouse reporting) across tab switches
  • Fixes issue where TUI apps like opencode, vim, htop would show blank/corrupted state after switching away and back

Test plan

  • Open a terminal and run a TUI app (e.g., htop, vim, or opencode)
  • Switch to a different tab
  • Switch back to the terminal tab
  • Verify the TUI app display is preserved correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved terminal state restoration by using the default serialization behavior, preserving alternate buffer, terminal modes, and scrollback so terminal UI apps (vim, system monitors) display correctly when reopening terminals.

✏️ Tip: You can customize this high-level summary in your review settings.

Include alternate screen buffer and terminal modes in serialization
so TUI apps (vim, htop, opencode) restore correctly when switching
between terminal tabs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

Replace explicit serialize call with addon-based serialization: serialize({ excludeAltBuffer: true, excludeModes: true, scrollback: 1000 }) was removed and replaced by serializeAddon.serialize() (no arguments), changing the source of terminal serializedState.

Changes

Cohort / File(s) Summary
Terminal serialization change
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
Replaced explicit serialize(...) call and its options with serializeAddon.serialize() (no args). Only the serialization invocation/source changed; detachment/reattach flow remains otherwise unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐇 I nibble bytes from silvered keys,

Alt buffers kept with gentle ease,
Modes and scroll preserved in line,
Reattached shells resume just fine,
A tiny hop for terminal peace.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: preserving terminal UI (TUI) state when switching between terminal tabs, which aligns with the code modification removing serialization constraints.
Description check ✅ Passed The PR description provides a clear summary of changes and test plan, but deviates from the template structure by omitting standard sections like 'Related Issues', 'Type of Change', and 'Screenshots'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae0dc8 and 7224983.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite merged commit f02bff8 into main Jan 8, 2026
4 of 5 checks passed
@Kitenite Kitenite deleted the improve-addon branch January 8, 2026 18:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 8, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

saddlepaddle pushed a commit that referenced this pull request Jan 10, 2026
* fix(desktop): preserve TUI state when switching terminal tabs

Include alternate screen buffer and terminal modes in serialization
so TUI apps (vim, htop, opencode) restore correctly when switching
between terminal tabs.
Remove scrollback limit.
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