Skip to content

fix(panel): position cursor on active file when toggling panel open#164

Merged
dlyongemallo merged 1 commit intomainfrom
show_panel_cursor
May 7, 2026
Merged

fix(panel): position cursor on active file when toggling panel open#164
dlyongemallo merged 1 commit intomainfrom
show_panel_cursor

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

Fixes #161.

Copilot AI review requested due to automatic review settings May 7, 2026 18:32
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

Fixes the inconsistency described in #161 where opening the file panel via :DiffviewToggleFiles (when file_panel.show = false) would not position the cursor on the currently active file entry.

Changes:

  • Update FilePanel:open() to re-highlight (and thus reposition the cursor on) the current active file when the panel transitions from closed → open.
  • Add a functional regression test ensuring toggling the panel open places the cursor on the active file entry.

Reviewed changes

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

File Description
lua/diffview/scene/views/diff/file_panel.lua Ensures open() positions the cursor on the active file by calling highlight_cur_file().
lua/diffview/tests/functional/cdiff_view_spec.lua Adds a regression test for cursor positioning when the panel is toggled open with file_panel.show = false.

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

Comment thread lua/diffview/tests/functional/cdiff_view_spec.lua Outdated
@dlyongemallo dlyongemallo merged commit 79b53b0 into main May 7, 2026
7 checks passed
@dlyongemallo dlyongemallo deleted the show_panel_cursor branch May 7, 2026 19:30
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.

[Bug] :DiffviewToggleFiles does not place the cursor on the current file when file_panel.show = false

2 participants