Skip to content

Polish right panel UI and terminal scrollback - #114

Merged
gedeagas merged 2 commits into
mainfrom
ui-improvement-polishing
May 29, 2026
Merged

gedeagas merged 2 commits into
mainfrom
ui-improvement-polishing

Conversation

@gedeagas

Copy link
Copy Markdown
Owner

Summary

  • Polish the right-panel changes/checks experience with clearer component boundaries, denser controls, and localized copy updates.
  • Add coverage for Add Worktree dialog branch selection behavior.
  • Increase terminal scrollback defaults and wire the user preference through live xterm instances plus PTY reconnect snapshots.

Layers touched

  • Main process (src/main/) — services, IPC handlers
  • Preload (src/preload/) — context bridge API
  • Renderer (src/renderer/) — components, stores, lib
  • Styles (App.css)

Changes

Sidebar / Center / Right panel:

  • Refactor changes/checks UI into clearer right-panel components and actions.
  • Improve checks and changes layout styling for scanning and repeated use.
  • Apply terminal scrollback preferences to right-panel, setup, standalone, and big terminal xterm instances without remounting active terminals.

Stores (projects.ts / sessions.ts / ui.ts):

  • Move terminal scrollback defaults and bounds into shared constants.
  • Clamp persisted and newly set scrollback values.

Services (git.ts / claude.ts / github.ts / pty.ts):

  • Make PTY and daemon ring buffers configurable.
  • Increase default reconnect/restart snapshot retention to match the higher terminal scrollback default.

IPC (main/ipc.tspreload/index.tslib/ipc.ts):

  • Sync terminalScrollback through the existing settings sync path and update PTY buffer limits when it changes.

How to test

  1. npm run typecheck
  2. npm test -- src/main/services/ptyDaemon/__tests__/protocol.test.ts src/main/services/ptyDaemon/__tests__/sessionHost.test.ts
  3. npm test -- src/renderer/components/Sidebar/__tests__/AddWorktreeDialog.test.tsx
  4. Open Settings → Editor & Terminal, adjust Scrollback Lines, and verify active terminals keep running while the new limit applies going forward.

Screenshots

N/A

Checklist

  • Self-reviewed the diff
  • Tested locally with yarn dev
  • Types pass — npm run typecheck
  • No console errors or warnings in DevTools
  • IPC changes use the existing settings sync path; no new preload/lib IPC surface
  • New state is added to the correct Zustand store

gedeagas added 2 commits May 29, 2026 11:34
…mposition

- Extract ChangeSectionHeader and ChangeRow components for improved reusability
- Add icon buttons with tooltips for section actions (stage/unstage/discard all)
- Enhance ChecksNoPr with branch info, refresh button, and improved empty states
- Add test coverage for AddWorktreeDialog user-edited branch handling
- Introduce `DEFAULT_TERMINAL_SCROLLBACK_LINES` (50k), min (100), and max (100k) constants in shared terminal module
- Add `clampTerminalScrollbackLines()` and `getTerminalScrollbackBufferMaxLength()` to enforce bounds and calculate buffer size
- Update RingBuffer in both `pty.ts` and `sessionHost.ts` to accept configurable `maxLength` in constructor and via `setMaxLength()`
- Sync scrollback setting from renderer to main process via `settings:sync` IPC, apply to all active PTY instances
- Add daemon protocol support: `spawn` now accepts optional `bufferMaxLength`, new `setBufferMaxLength` request type
- Update all terminal views (BigTerminalView, TerminalPanel, SetupPanel) to watch for scrollback changes and update xterm options live
- Validate user input in SettingsEditor with proper clamping bounds
Copilot AI review requested due to automatic review settings May 29, 2026 02:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces dynamic terminal scrollback configuration across the application, allowing users to customize scrollback limits which are clamped and dynamically applied to active PTYs, daemon sessions, and renderer terminal instances. It also refactors the git changes file list into modular components (ChangeRow and ChangeSectionHeader) with improved styling and accessibility, enhances the "No PR" checks view with branch information and refresh actions, and fixes a bug in the worktree dialog where a user-edited or Jira-derived branch name could be overwritten when remote branches finished loading. The review feedback suggests a safer parsing approach for the terminalScrollback setting in the IPC handler to prevent type pollution from non-number values.

Comment thread src/main/ipc.ts
Comment on lines +556 to +558
if (typeof values.terminalScrollback === 'number') {
values.terminalScrollback = clampTerminalScrollbackLines(values.terminalScrollback)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current check only validates if values.terminalScrollback is strictly of type number. Since this is an IPC handler receiving data from the renderer, it is safer to defensively parse the value (e.g., if it is passed as a string) and ensure it is a finite number before clamping it. This prevents potential type pollution of mainSettings.terminalScrollback with non-number values (like strings or null).

    if (values.terminalScrollback !== undefined && values.terminalScrollback !== null) {
      const parsed = Number(values.terminalScrollback)
      if (Number.isFinite(parsed)) {
        values.terminalScrollback = clampTerminalScrollbackLines(parsed)
      } else {
        delete values.terminalScrollback
      }
    } else if (values.terminalScrollback === null) {
      delete values.terminalScrollback
    }

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Polishes the right-panel changes/checks UI, raises terminal scrollback defaults, and threads scrollback configuration through live xterm instances and PTY ring buffers (including the PTY daemon protocol). Also adds a regression test for Jira-derived branch preservation in AddWorktreeDialog.

Changes:

  • Refactor ChangeFileList and ChecksSections/ChecksNoPr into clearer sub-components with new icons, denser controls, and richer empty/no-PR states; matching CSS in changes*.css/checks.css/dialogs.css; localized copy updates in all four locales.
  • Centralize terminal scrollback constants/clamping in src/shared/terminal.ts, apply them in the UI store, SettingsEditor, and live in right-panel, setup, standalone, and big xterm instances (without remounting); sync terminalScrollback to main via existing settings:sync.
  • Make PTY/daemon ring buffers configurable (RingBuffer(maxLength), setBufferMaxLength, setScrollbackBufferMaxLength, SpawnRequest.bufferMaxLength, new daemon setBufferMaxLength request), with BUFFER_MAX_LENGTH derived from the shared default; add AddWorktreeDialog test for Jira branch preservation across late remote loads.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/shared/terminal.ts New shared scrollback constants, clamp, and char-buffer conversion.
src/renderer/store/ui/terminal.ts Clamp persisted/new scrollback values using shared helper.
src/renderer/components/Settings/SettingsEditor.tsx Use shared min/max/clamp and update draft after blur.
src/renderer/components/Right/terminalCache.ts Set scrollback on creation; add updateScrollbackAllTerminals.
src/renderer/components/Right/useTerminalLifecycle.ts Apply scrollback on mount and on store changes.
src/renderer/components/Right/TerminalPanel.tsx Live-update standalone terminal scrollback.
src/renderer/components/Right/SetupPanel.tsx Apply scrollback to setup terminals on mount/changes.
src/renderer/components/Center/bigTerminalCache.ts Set scrollback on reuse; add updateScrollbackAllBigTerminals.
src/renderer/components/Center/BigTerminalView.tsx Subscribe to scrollback changes for big terminals.
src/renderer/App.tsx Include terminalScrollback in settings:sync payload.
src/main/ipc.ts Default/clamp terminalScrollback; push to PTY service on change.
src/main/services/pty.ts Configurable RingBuffer; setScrollbackBufferMaxLength.
src/main/services/ptyDaemon/protocol.ts Default buffer from shared; new SpawnRequest.bufferMaxLength and setBufferMaxLength request.
src/main/services/ptyDaemon/sessionHost.ts RingBuffer takes max; live resize; per-host setter.
src/main/services/ptyDaemon/socketServer.ts Forward spawn buffer max; handle setBufferMaxLength.
src/main/services/ptyDaemon/client.ts Spawn passes buffer max; new client method.
src/main/services/ptyDaemon/adapter.ts Size local/daemon buffers from current setting; best-effort daemon update.
src/main/services/ptyDaemon/tests/{protocol,sessionHost}.test.ts Updated for derived default and explicit RingBuffer size.
src/renderer/components/Right/ChangeFileList.tsx Refactor into ChangeSectionHeader/ChangeRow, use real buttons + icons.
src/renderer/components/Right/ChangesView.tsx Use icon components for generate/refresh/pull; add type="button".
src/renderer/components/Right/useChangesActions.ts Propagate staged flag to discard confirm payload.
src/renderer/components/Right/ChecksView.tsx Derive branch name; pass refresh/branch/updated props to ChecksNoPr.
src/renderer/components/Right/ChecksSections.tsx Add icon to ActionButton; richer no-checks/no-PR layouts.
src/renderer/styles/{changes,changes-controls,checks,dialogs}.css Styles for new controls, empty blocks, no-PR card, Jira card grid.
src/renderer/locales/{en,id,ja,zh}/right.json Updated noChecks/noPrHint; new noChecksHint/allChangesStaged.
src/renderer/components/Sidebar/AddWorktreeDialog.tsx Move userEdited preservation into reducer; drop useRef mirror.
src/renderer/components/Sidebar/tests/AddWorktreeDialog.test.tsx New test for Jira branch preservation across late remote load.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gedeagas
gedeagas merged commit 28051bf into main May 29, 2026
1 check passed
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.

2 participants