Skip to content

feat(ui): add pager sidebar toggle#216

Open
clabby wants to merge 1 commit intomodem-dev:mainfrom
clabby:cl/pager-sidebar
Open

feat(ui): add pager sidebar toggle#216
clabby wants to merge 1 commit intomodem-dev:mainfrom
clabby:cl/pager-sidebar

Conversation

@clabby
Copy link
Copy Markdown
Contributor

@clabby clabby commented May 7, 2026

Overview

Adds the ability to toggle the sidebar in pager mode. This makes navigating larger diffs a bit easier when using hunk as the pager for jj or git.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

This PR extends pager mode with a toggleable sidebar file tree, allowing users to press s to reveal or hide the file list while keeping the normal pager chrome (menu bar) hidden. The implementation is clean: sidebarVisible is initialized to !pagerMode so the sidebar starts hidden in pager mode, and the hard pagerMode ? false : … guard in renderSidebar is replaced by letting sidebarVisible own the behavior directly.

  • App.tsx: pagerMode is hoisted before the state declarations so the lazy useState(() => !pagerMode) initializer can reference it; renderSidebar is simplified by removing the unconditional false branch for pager mode.
  • useAppKeyboardShortcuts.ts: Adds an s handler to handlePagerShortcut calling toggleSidebar; also adds a missing return after toggleLineWrap that would have caused unnecessary fall-through evaluation.
  • Both unit (AppHost.interactions.test.tsx) and PTY integration (ui-integration.test.ts) tests cover the toggle-on / toggle-off cycle and confirm the menu bar stays hidden.

Confidence Score: 5/5

Safe to merge; the change is well-scoped and both unit and PTY integration tests cover the new toggle behaviour.

The refactor is minimal and mechanically correct: moving pagerMode before the state declarations, initialising sidebarVisible with !pagerMode, and wiring up the s handler in handlePagerShortcut all work together cleanly. No existing behaviour is broken for non-pager mode.

No files require special attention.

Important Files Changed

Filename Overview
src/ui/App.tsx Moves pagerMode computation before state declarations and simplifies renderSidebar logic by letting sidebarVisible (initialized to !pagerMode) own the hiding behavior instead of a hard pagerMode ternary.
src/ui/hooks/useAppKeyboardShortcuts.ts Adds s key handler to handlePagerShortcut to call toggleSidebar; also fixes a latent fall-through by adding a missing return after toggleLineWrap in the pager shortcut handler.
src/ui/AppHost.interactions.test.tsx Adds a new interaction test verifying the sidebar can be toggled on and off in pager mode using the s shortcut, and that the menu bar remains hidden throughout.
test/pty/ui-integration.test.ts Adds a PTY-level integration test confirming sidebar appears with expected file-tree row format after pressing s in pager mode, with no menu bar visible.
CHANGELOG.md Documents the new pager-mode sidebar toggle under the Added section for the upcoming release.

Sequence Diagram

sequenceDiagram
    participant User
    participant useAppKeyboardShortcuts
    participant App as App.tsx (state)
    participant Renderer

    Note over App: pagerMode=true, sidebarVisible=false (initial)
    App->>Renderer: "renderSidebar = false"

    User->>useAppKeyboardShortcuts: press s
    useAppKeyboardShortcuts->>App: toggleSidebar()
    App->>App: setSidebarVisible(true)
    App->>Renderer: "renderSidebar = true"

    User->>useAppKeyboardShortcuts: press s again
    useAppKeyboardShortcuts->>App: toggleSidebar()
    App->>App: setSidebarVisible(false)
    App->>Renderer: "renderSidebar = false"
Loading

Reviews (1): Last reviewed commit: "feat(ui): add pager sidebar toggle" | Re-trigger Greptile

@clabby clabby force-pushed the cl/pager-sidebar branch from 1727e3f to 4599de1 Compare May 8, 2026 17:48
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