You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: redesign diff view with horizontal layout and new tab options (#111)
# Improved Diff View Layout and Configuration
This PR refactors the diff view functionality to provide more flexible layout options and better tab management:
- Added a new `layout` option to replace the previous `vertical_split` boolean, supporting both "vertical" and "horizontal" layouts
- Replaced `open_in_current_tab` with `open_in_new_tab` for more intuitive configuration
- Removed redundant options `auto_close_on_accept` and `show_diff_stats` that were no longer used
- Added proper type annotations for configuration options
- Implemented improved window management when opening diffs in new tabs
- Added terminal window preservation when opening diffs in new tabs
- Improved window option handling to maintain consistent appearance across different layouts
- Enhanced cleanup logic to properly handle both tab-based and window-based diff views
- Updated tests to reflect the new configuration options
These changes make the diff view more customizable while simplifying the configuration interface. Users can now choose between vertical or horizontal layouts and easily open diffs in new tabs while maintaining access to the terminal.
The `diff_opts` configuration allows you to customize diff behavior:
290
290
291
291
-`keep_terminal_focus` (boolean, default: `false`) - When enabled, keeps focus in the Claude Code terminal when a diff opens instead of moving focus to the diff buffer. This allows you to continue using terminal keybindings like `<CR>` for accepting/rejecting diffs without accidentally triggering other mappings.
292
+
-`open_in_new_tab` (boolean, default: `false`) - Open diffs in a new tab instead of the current tab.
293
+
-`hide_terminal_in_new_tab` (boolean, default: `false`) - When opening diffs in a new tab, do not show the Claude terminal split in that new tab. The terminal remains in the original tab, giving maximum screen estate for reviewing the diff.
292
294
293
295
**Example use case**: If you frequently use `<CR>` or arrow keys in the Claude Code terminal to accept/reject diffs, enable this option to prevent focus from moving to the diff buffer where `<CR>` might trigger unintended actions.
294
296
295
297
```lua
296
298
require("claudecode").setup({
297
299
diff_opts= {
298
300
keep_terminal_focus=true, -- If true, moves focus back to terminal after diff opens
301
+
open_in_new_tab=true, -- Open diff in a separate tab
302
+
hide_terminal_in_new_tab=true, -- In the new tab, do not show Claude terminal
0 commit comments