feat(file_panel): add follow navigation#233
Conversation
|
I don't understand what this change does. AFAICT, the behaviour you describe is already the existing behaviour with If you just want this behaviour mapped to keymaps = {
file_panel = {
{ "n", "j", actions.select_next_entry, { desc = "Open diff for next file" } },
{ "n", "k", actions.select_prev_entry, { desc = "Open diff for previous file" } },
},
} Also, can you describe the bug behind the layout swap restore focus fix? For example, what is a repro case? |
|
Okay, I've reproduced the bug and verified 9660f7a fixes it. |
|
I've merged the fix. I'm still not sure about the feature request. |
|
Thanks, and sorry for the noise. You were right about the feature request. I had just migrated from |
|
@jensenojs Thanks for the focus bug fix! |
Summary
Allow users to keep the file panel focused while browsing diffs with
j/k.This adds an opt-in
file_panel.follow_navigationsetting. When enabled, the existing file-panelnext_entry/prev_entryactions also preview the file under the cursor without moving focus out of the panel.The default behavior and default keymaps stay unchanged. Users who want this behavior only on selected mappings can use the new
actions.next_entry_followandactions.prev_entry_followactions directly.Why the focus fix is included
file_panel.follow_navigationrelies onset_file(..., focus=false, ...)so that previewing a file does not move focus out of the file panel.Some file changes recreate the diff layout, for example when
view.one_sided_layout = "raw"switches between a two-window diff layout and a one-window raw layout. The layout recreation could move focus back to the diff window even though the caller passedfocus=false.This PR preserves the original file-panel focus across that layout swap.