Skip to content

feat(ui): let the commit graph be hidden so the diff can fill the column - #83

Merged
noahbclarkson merged 3 commits into
mainfrom
feat/toggle-commit-graph
Sep 16, 2026
Merged

noahbclarkson merged 3 commits into
mainfrom
feat/toggle-commit-graph

Conversation

@noahbclarkson

@noahbclarkson noahbclarkson commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Closes #81.

What it does

The commit graph can now be hidden. The bottom panel (Diff, History, Blame, and the rest) then takes the whole centre column. Two ways to do it:

  • Mouse: a chevron at the right end of the bottom panel's Diff / History / Blame tab bar. It points up to hide the graph and down to bring it back. That bar stays on screen either way, so one button covers both directions. The tooltip shows the shortcut.
  • Keyboard: Ctrl+Shift+G (rgitui::ToggleGraph, rebindable in keymap.json), plus View: Toggle Commit Graph in the command palette.

The setting is saved with the rest of the layout and in saved workspaces. Settings files from before this change load with the graph shown. The diff viewer's height is kept while the graph is hidden, so showing it again restores your split.

Focus

A hidden graph isn't rendered, so focus left on it would silently break every shortcut. To prevent that:

  • Focus sent to the graph goes to the diff viewer instead. That covers startup focus, focus restored after dialogs, and the Tab cycle.
  • Tab / Shift+Tab skip the graph while it's hidden.
  • Alt+2 (focus graph) and graph search (Ctrl+F, /) bring the graph back rather than doing nothing.
  • If focus is inside the graph when it's hidden, including its search box, it moves to the diff viewer on the next frame.

Diff viewer height (separate fix)

The diff viewer no longer stops at a fixed 600px. Dragging the splitter or Ctrl+Down can now grow it until the graph is down to 120px. On a tall window the diff is no longer stuck at a fraction of the column.

Rendering applies both minimums with flex constraints rather than the measured content size. The measurement lags one frame behind a window resize, and I saw that in the running app: after a maximise, the panel stayed at the old size until something else caused a repaint.

Testing

  • cargo clippy --workspace --all-targets -- -D warnings, with and without --features rgitui/perf.
  • cargo test --workspace.
  • New unit tests:
    • Tab order skips a hidden graph.
    • Focus meant for a hidden graph goes to the diff viewer.
    • The height limits, including before the first measurement.
    • Old layout JSON loads with the graph shown, and the new field round-trips.
  • Regenerated docs/KEYBINDINGS.md and docs/keymap.schema.json with RGITUI_BLESS=1, and updated the README shortcut table.
  • Tried in the running app on Windows (isolated settings, screenshots at each step):
    • The chevron hides and shows the graph.
    • Ctrl+Shift+G hides it.
    • The palette entry is the only result for "commit graph" and shows the graph again.
    • The tooltip reads "Hide commit graph Ctrl+Shift+G".
    • Ctrl+Down grows the diff to about 830px, leaving about three rows of graph.

Found along the way (not changed here)

  • Debug builds crash on Windows. Unoptimised debug builds overflow the main thread's stack about a second after opening a repo. This happens on main too, and release builds are fine. For a runnable debug binary: cargo rustc -p rgitui --bin rgitui -- -C link-arg=/STACK:16777216.
  • Shortcuts stop working after the command palette closes. Nothing gives focus back when it closes, whether a command runs or it's dismissed, so shortcuts do nothing until you click a panel. This affects every palette command, including pressing Ctrl+Shift+G right after using the palette to toggle. A fix would likely be setting pending_focus_restore on CommandSelected and Dismissed. It's a separate change.

Both items above were fixed by #84, which is now merged into this branch.

Review fixes (0d94585, 9302c92)

  • Codex: hidden-graph focus went to an undrawn diff viewer when another view filled the bottom panel. The merge of main (fix: hand focus back when overlays close, and raise the Windows stack #84) fixes it: focus_panel(DiffViewer) now focuses whichever view the bottom panel draws, and every redirect here goes through it.
  • Same bug, Tab cycling: with the graph hidden and Reflog / File History / Submodules / Search / Bisect focused, Tab kept focus in place, because those views weren't recognised as the bottom panel. ProjectTab::bottom_panel_focused now covers every bottom-panel view. The render's focus highlight also uses it, which adds Bisect to the highlight.

Verified on the merged tree with cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace (1737 passed, 0 failed).

🤖 Generated with Claude Code

Closes #81.

The commit graph can now be hidden, handing its space to the bottom
panel (diff, history, blame and the rest), and shown again:

- Mouse: a chevron at the right end of the bottom panel's tab bar. That
  bar is on screen in both states, so one control covers both
  directions. Its tooltip names the shortcut.
- Keyboard: Ctrl+Shift+G (`rgitui::ToggleGraph`, rebindable), plus a
  "View: Toggle Commit Graph" command palette entry.

The choice is saved with the rest of the layout and in saved
workspaces. Settings files written before it existed load with the
graph shown. The diff viewer's own height is kept while the graph is
hidden, so showing it again restores the previous split.

Focus follows the graph away: a hidden graph is out of the element
tree, so focus left on it would strand every shortcut. Requests for the
graph go to the diff viewer instead, Tab and Shift+Tab step over it,
and Alt+2 and graph search bring it back rather than doing nothing.

The diff viewer also loses its fixed 600px ceiling. It can grow until
the graph is down to 120px, so on a tall window it is no longer held
to a fraction of the column. Rendering enforces both minimums through
flex constraints rather than the measured content bounds, which lag a
frame behind a resize.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T11:24:56.629323Z 97952c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97952c16d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +266 to +267
if graph_hidden && self == Self::Graph {
Self::DiffViewer

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Route hidden-graph focus to the visible bottom view

When the graph has focus while File History, Reflog, Submodules, Global Search, or Bisect is the active bottom mode, hiding the graph redirects focus to FocusedPanel::DiffViewer; however, focus_panel only specializes Blame and otherwise focuses the unrendered diff_viewer entity. The visible bottom view therefore receives no focus and keyboard shortcuts remain stranded until the user clicks a panel. Route this redirect according to bottom_panel_mode (or switch the mode to Diff) so it always focuses a rendered entity.

Useful? React with 👍 / 👎.

noahbclarkson and others added 2 commits September 16, 2026 20:37
…draws

Addresses the Codex finding on this PR, and a Tab-cycling case of the
same bug.

- Hiding the graph while it held focus handed focus to the diff viewer
  even when File History, Reflog, Submodules, Global Search or Bisect
  filled the bottom panel. The diff viewer is not drawn then, so focus
  was stranded and shortcuts went dead until a click. Merging main
  (#84) resolves it: `focus_panel(DiffViewer)` now focuses whichever
  view the bottom panel draws, and every route here goes through it -
  the render's hidden-graph redirect, Tab / Shift+Tab, Alt+4, initial
  focus, and the fallback when an overlay closes.

- With the graph hidden and one of those views focused, Tab left focus
  where it was. `current_focused_panel` recognised only the diff viewer
  and blame, so the cycle started from nothing, at the graph, which a
  hidden graph resolves straight back to the bottom panel. A
  `ProjectTab::bottom_panel_focused` helper now covers every view the
  bottom panel can show, and the render's focus highlight uses it too,
  which also adds the Bisect view it had left out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@noahbclarkson
noahbclarkson merged commit d215246 into main Sep 16, 2026
0 of 4 checks passed
@vincent-moral

Copy link
Copy Markdown

Thank you for that, I will try this out! 🙂

noahbclarkson added a commit that referenced this pull request Oct 7, 2026
Changelog entry for everything since 0.4.1: #78, #79, #80, #82, #83, #84,
#86, #87 and the model-picker follow-up pushed to main. The version is bumped
across the workspace, and the AppStream metainfo lists 0.5.0, which the Linux
metadata test requires before the crate version can move.

The AI work (#79, #80, #82) had no changelog entries; it now has them, with
each fix checked against the 0.4.1 code so that only bugs that shipped are
listed as fixed. The model-picker fixes in #82 are folded into the feature
for that reason: the picker did not exist in 0.4.1.

The drafts already under [Unreleased] are checked against the code and
corrected where they were off: binary, symlink, submodule and modify/delete
conflicts are the whole-file cases (add/add is resolved per region), Stage
All skips conflicted files rather than refusing, double-clicking the commit
the current branch is on shows a toast, and the diff viewer grows until the
graph is down to 120px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

hide commit graph

2 participants