Skip to content

fix(file_history): position cursor on active item when panel starts open#166

Merged
dlyongemallo merged 1 commit intomainfrom
file_history_panel_cursor
May 8, 2026
Merged

fix(file_history): position cursor on active item when panel starts open#166
dlyongemallo merged 1 commit intomainfrom
file_history_panel_cursor

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

@dlyongemallo dlyongemallo commented May 8, 2026

Fixes #161.

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

Adjusts the FileHistory view’s panel refresh/bootstrap logic so that when the file history panel starts open, the cursor can be positioned on the active item (by ensuring the panel is fully synced before the initial item selection/highlight occurs).

Changes:

  • Call FileHistoryPanel:sync() unconditionally during throttled PROGRESS rendering in update_entries().
  • Remove the prior special-case update_components() call on the “no current file yet” bootstrap path, and rely on sync() instead.

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

Comment on lines +273 to 276
self:sync()
if not self:cur_file() then
self:update_components()
self.parent:next_item()
else
self:sync()
end
Comment thread lua/diffview/scene/views/file_history/file_history_panel.lua
@dlyongemallo dlyongemallo force-pushed the file_history_panel_cursor branch from ef6ecc2 to d983966 Compare May 8, 2026 07:51
@dlyongemallo dlyongemallo merged commit fe01c7c into main May 8, 2026
7 checks passed
@dlyongemallo dlyongemallo deleted the file_history_panel_cursor branch May 8, 2026 07: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.

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

2 participants