Skip to content

add Q hotkey to discard annotations and quit#4

Merged
umputun merged 2 commits intomasterfrom
discard-quit
Apr 2, 2026
Merged

add Q hotkey to discard annotations and quit#4
umputun merged 2 commits intomasterfrom
discard-quit

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented Apr 2, 2026

adds Q (shift+q) to exit revdiff without outputting annotations. when annotations exist, shows inline confirmation in the status bar ("discard N annotations? [y/n]"). second Q or y confirms, n/Esc cancels.

if no annotations exist, Q behaves the same as q.

--no-confirm-discard flag (env REVDIFF_NO_CONFIRM_DISCARD, config no-confirm-discard) skips the prompt. also skips when status bar is hidden (--no-status-bar).

changes

  • ui/model.go - discard state fields, handleDiscardQuit(), handleConfirmDiscardKey(), updated status bar hints
  • cmd/revdiff/main.go - --no-confirm-discard option, skip output when discarded
  • ui/model_test.go - 11 new tests covering all discard/confirm scenarios
  • cmd/revdiff/main_test.go - flag parsing test

add Q hotkey to discard all annotations and quit without output.
when annotations exist, show inline confirmation in status bar.
confirmation is skippable via --no-confirm-discard flag.
Copilot AI review requested due to automatic review settings April 2, 2026 02:21
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 new “discard and quit” flow to the revdiff TUI: pressing Q exits without emitting annotations, optionally prompting for confirmation when annotations exist (unless disabled via config/flags or when the status bar is hidden).

Changes:

  • Add Q handling to the UI model, including an inline confirm prompt in the status bar and a Discarded() accessor for the final model.
  • Add --no-confirm-discard (env/config supported) and skip output emission when the session was discarded.
  • Add unit tests for confirmation scenarios and update user-facing documentation (README + plugin reference docs).

Reviewed changes

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

Show a summary per file
File Description
ui/model.go Implements discard/confirm state, Q hotkey handling, and status bar messaging.
ui/model_test.go Adds tests covering discard/confirm scenarios and config wiring.
cmd/revdiff/main.go Adds --no-confirm-discard plumbing and skips output when m.Discarded() is true.
cmd/revdiff/main_test.go Adds flag/env/config parsing tests for --no-confirm-discard.
README.md Documents the new option and Q keybinding.
docs/plans/completed/20260401-discard-quit.md Records the completed implementation plan and acceptance criteria.
.claude-plugin/skills/revdiff/references/usage.md Updates keybindings reference to include Q.
.claude-plugin/skills/revdiff/references/config.md Updates config/options reference to include --no-confirm-discard.

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

Comment thread cmd/revdiff/main_test.go Outdated

func TestParseArgs_NoConfirmDiscard(t *testing.T) {
t.Run("flag", func(t *testing.T) {
opts, err := parseArgs([]string{"--no-confirm-discard"})
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

TestParseArgs_NoConfirmDiscard's "flag" subtest calls parseArgs([]string{"--no-confirm-discard"}) without the --config isolation that noConfigArgs is meant to provide (to avoid picking up a user's real default config at ~/.config/revdiff/config). This can make the test environment-dependent. Update the test to include a temp --config path (e.g., parseArgs(append(noConfigArgs(t), "--no-confirm-discard"))), or bring back an extra ...string helper pattern.

Suggested change
opts, err := parseArgs([]string{"--no-confirm-discard"})
opts, err := parseArgs(append(noConfigArgs(t), "--no-confirm-discard"))

Copilot uses AI. Check for mistakes.
@umputun umputun merged commit 3f6fbd4 into master Apr 2, 2026
2 checks passed
@umputun umputun deleted the discard-quit branch April 2, 2026 02:35
sanchesfree pushed a commit to sanchesfree/revdiff that referenced this pull request Apr 8, 2026
* feat: add discard-quit confirmation flow with Q keypress

add Q hotkey to discard all annotations and quit without output.
when annotations exist, show inline confirmation in status bar.
confirmation is skippable via --no-confirm-discard flag.

* fix: use noConfigArgs in flag parsing test to isolate from user config
@nvahalik nvahalik mentioned this pull request Apr 16, 2026
6 tasks
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