Skip to content

Revert terminal scroll position saving#742

Merged
Kitenite merged 2 commits intomainfrom
revert-resume-logic
Jan 14, 2026
Merged

Revert terminal scroll position saving#742
Kitenite merged 2 commits intomainfrom
revert-resume-logic

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 14, 2026

Summary

This removes the terminal scroll position saving/restoring functionality.

Test plan

  • Verify terminals no longer save scroll position when switching tabs
  • Verify terminals behave correctly without scroll position persistence

Summary by CodeRabbit

  • Refactor
    • Simplified terminal session management by streamlining viewport handling operations and cleanup processes.
    • Reduced complexity in terminal detach operations and scroll position management.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

This PR removes viewportY (viewport position tracking) from the terminal subsystem across multiple layers: type definitions, the terminal manager, the tRPC router, and UI components. This includes eliminating scroll restoration utilities and updating API signatures to no longer pass or return viewport position data.

Changes

Cohort / File(s) Summary
Terminal Type Definitions
apps/desktop/src/main/lib/terminal/types.ts
Removed optional viewportY?: number property from TerminalSession and SessionResult interfaces.
Terminal Manager
apps/desktop/src/main/lib/terminal/manager.ts
Removed viewportY from the SessionResult return object in createOrAttach and removed the optional viewportY parameter from the detach method signature.
tRPC Router
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
Removed viewportY from the createOrAttach mutation return payload and removed viewportY from the detach mutation input schema.
Renderer Component & Utilities
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx, utils.ts
Removed scroll restoration logic and viewportY handling from the detach call; removed exported utility functions getScrollOffsetFromBottom and restoreScrollPosition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A viewport once tracked where we'd scroll,
But now we let go of that role—
With viewportY gone and its friends,
The terminal's journey transcends!
Simpler, cleaner, off we go.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Revert terminal scroll position saving' accurately describes the main change—removing terminal scroll position saving/restoring functionality across multiple files.
Description check ✅ Passed The description clearly explains the purpose (reverting two PRs), what is being removed, and includes a test plan section as required by the template.
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 7ab29c5 and 39bfa8c.

📒 Files selected for processing (5)
  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
  • apps/desktop/src/main/lib/terminal/manager.ts
  • apps/desktop/src/main/lib/terminal/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/utils.ts
💤 Files with no reviewable changes (3)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/utils.ts
  • apps/desktop/src/main/lib/terminal/types.ts
  • apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/main/lib/terminal/manager.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid using any type - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness

Files:

  • apps/desktop/src/main/lib/terminal/manager.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations - never use raw SQL

Files:

  • apps/desktop/src/main/lib/terminal/manager.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for formatting and linting - run at root level with bun run lint:fix or biome check --write

Files:

  • apps/desktop/src/main/lib/terminal/manager.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

One component per file - do not create multi-component files

Files:

  • 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
🔇 Additional comments (4)
apps/desktop/src/main/lib/terminal/manager.ts (1)

241-251: LGTM!

The detach method signature simplification aligns with the PR's objective to remove scroll position persistence. The method now cleanly handles only session activity tracking without the viewportY parameter.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx (3)

28-28: LGTM!

Import updated to reflect removed scroll restoration utilities (getScrollOffsetFromBottom, restoreScrollPosition). The remaining imports (shellEscapePaths, smoothScrollToBottom) are still used in the component.


379-386: LGTM!

The applyInitialState function is correctly simplified to just write the scrollback buffer and update the cwd state. The removal of scroll position restoration logic aligns with the revert objective.


564-566: LGTM!

The cleanup correctly calls detach with only { paneId }, matching the updated API signature. The comment clearly explains the intent to keep the PTY running for potential reattachment.


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 ff6c151 into main Jan 14, 2026
5 checks passed
@Kitenite Kitenite deleted the revert-resume-logic branch January 14, 2026 00:08
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

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

Thank you for your contribution! 🎉

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.

[bug] Blinking cursor at bottom of claude running on some machines

1 participant