Skip to content

Add --collapsed flag to start in collapsed diff mode#14

Merged
umputun merged 2 commits intomasterfrom
add-collapsed-flag
Apr 4, 2026
Merged

Add --collapsed flag to start in collapsed diff mode#14
umputun merged 2 commits intomasterfrom
add-collapsed-flag

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented Apr 4, 2026

Add --collapsed CLI flag to start revdiff in collapsed diff mode by default.

  • CLI flag --collapsed, config file collapsed = true, env var REVDIFF_COLLAPSED
  • Mirrors existing --wrap flag pattern exactly
  • Users can set their preferred view mode in ~/.config/revdiff/config and toggle with v per-session

allow users to persist collapsed mode preference via CLI flag,
config file, or REVDIFF_COLLAPSED env var
Copilot AI review requested due to automatic review settings April 4, 2026 18:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a --collapsed startup option so revdiff can begin in collapsed diff mode (mirroring the existing --wrap pattern) and wires it through CLI/config/env into the UI model.

Changes:

  • Add Collapsed to ui.ModelConfig and initialize the model’s collapsed state from config.
  • Add --collapsed / REVDIFF_COLLAPSED / collapsed = true option plumbing in cmd/revdiff.
  • Document the new flag and add argument/model config tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/model.go Adds ModelConfig.Collapsed and initializes collapsed mode from config at model creation.
ui/model_test.go Adds tests for collapsed mode config defaulting; adjusts an existing navigation comment.
cmd/revdiff/main.go Introduces --collapsed CLI/config/env option and passes it to ui.NewModel.
cmd/revdiff/main_test.go Adds coverage for parsing --collapsed via flag/env/config.
README.md Documents the new --collapsed option and env var.
.claude-plugin/skills/revdiff/references/config.md Updates config reference table with --collapsed.

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

ui/model_test.go Outdated
assert.Equal(t, 2, model.diffCursor, "cursor should move to second match")

// N should navigate to previous search match
// n should navigate to previous search match
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

The comment says n navigates to the previous search match, but this assertion is for the N (uppercase) key. Update the comment to match the behavior being tested to avoid confusion when reading/debugging the test.

Suggested change
// n should navigate to previous search match
// N should navigate to previous search match

Copilot uses AI. Check for mistakes.
@umputun umputun merged commit 02ee223 into master Apr 4, 2026
2 checks passed
@umputun umputun deleted the add-collapsed-flag branch April 4, 2026 18:11
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