Skip to content

feat(view): add focus_diff option, fix selected_row focus#61

Merged
dlyongemallo merged 1 commit intomainfrom
add_focus_diff_option
Mar 28, 2026
Merged

feat(view): add focus_diff option, fix selected_row focus#61
dlyongemallo merged 1 commit intomainfrom
add_focus_diff_option

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 25, 2026 14:22
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 per-view configuration option to control whether Diffview focuses the diff window on initial open, and adjusts initial selected_row positioning to focus the main diff window.

Changes:

  • Introduce view.<section>.focus_diff (default/merge_tool/file_history) with default false.
  • Route initial focus in DiffView:update_files() and FileHistoryView:post_open() based on focus_diff.
  • Add functional specs covering config defaults/overrides, focus routing, and selected_row focusing behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
lua/diffview/config.lua Adds focus_diff = false defaults to each view section.
lua/diffview/scene/views/diff/diff_view.lua Uses focus_diff to decide whether to focus diff window on first open; focuses main win when applying selected_row.
lua/diffview/scene/views/file_history/file_history_view.lua Passes view.file_history.focus_diff into set_file() during initial open.
lua/diffview/tests/functional/focus_diff_spec.lua Adds new functional tests for config + focus behavior (with some test maintainability concerns).

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

Comment thread lua/diffview/tests/functional/focus_diff_spec.lua Outdated
Comment thread lua/diffview/tests/functional/focus_diff_spec.lua
Comment thread lua/diffview/tests/functional/focus_diff_spec.lua Outdated
@dlyongemallo dlyongemallo force-pushed the add_focus_diff_option branch from 49ecc4e to 9f2d195 Compare March 26, 2026 22:26
@dlyongemallo dlyongemallo merged commit 12d7db5 into main Mar 28, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the add_focus_diff_option branch March 29, 2026 07:37
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