Skip to content

feat: add keep_terminal_focus option for diff views #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ThomasK33
Copy link
Member

Add keep_terminal_focus option for diffs

Added a new configuration option keep_terminal_focus that allows users to maintain focus in the Claude Code terminal when a diff opens. This is particularly useful for users who frequently use terminal keybindings like <CR> to accept/reject diffs without accidentally triggering unintended actions in the diff buffer.

The feature:

  • Adds a new boolean option keep_terminal_focus (default: false) to diff_opts
  • Finds the Claude Code terminal window after opening a diff
  • Returns focus to the terminal window when the option is enabled
  • Includes documentation in README and CLAUDE.md
  • Adds unit tests to verify configuration validation

Example usage:

require("claudecode").setup({
  diff_opts = {
    keep_terminal_focus = true,  -- Keeps focus in terminal after diff opens
  },
})

Copy link
Member Author

ThomasK33 commented Jul 30, 2025

Change-Id: I196b3e69832c55aa56ab07b185cd643b3937b8a8
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_keep_terminal_focus_option_for_diff_views branch from 0e864f3 to fe2d961 Compare August 4, 2025 08:49
@ThomasK33 ThomasK33 marked this pull request as ready for review August 4, 2025 08:49
@ThomasK33 ThomasK33 merged commit 70fa226 into main Aug 4, 2025
4 checks passed
@ThomasK33 ThomasK33 deleted the thomask33/feat_add_keep_terminal_focus_option_for_diff_views branch August 4, 2025 08:56
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.

[FEATURE] Provide an option to keep focus on the terminal when diff pops up
1 participant