jesseduffield.lazygit/pkg/gui/controllers
Stefan Haller 1fcbc4d5a5 Parse the f/h header records a conforming pager emits
The spec regained file-header (f) and hunk-header (h) records: f never
carries a line number, h always does (the first line of the hunk it
heads). Accept them in the OSC metadata backend, so a conforming pager's
header rows resolve to the same DiffLineFileHeader/DiffLineHunkHeader
identities the buffer parser already reports for raw diffs.

With header rows located, next/previous file navigation and the
jump-to-file menu land on a file's header row, and header rows become
usable scroll-restore anchors. The consumers need a few adjustments:

- File navigation used to reach a file's top by backing up over the
  untagged rows above its first located row. With tagged headers that
  overshoots onto the blank separator row above the file header, so drop
  the back-up (backUpOverHeader) and land on the first located row
  itself: the header for any conforming source, or the first content
  line under a pager that leaves its headers untagged — an accepted
  degradation for non-conforming pagers, now that the spec makes f/h
  mandatory.

- SamePatchLine now requires headers to match headers of the same kind.
  A hunk header shares its line number with the hunk's first content
  line (and a file header shares "0" with a deleted file's hunk header),
  so without this a position restore aiming at one could land on the
  other. This also applied to raw diffs before, but headers used to be
  unlikely restore targets; now that navigation deliberately lands on
  them, the ambiguity would bite.

- Editing a file-header row opens the file without jumping to a line,
  like pressing edit on a whole file in a side panel. (It used to open
  at line 1 for raw diffs, where headers resolved already.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 12:59:00 +02:00
..
helpers Parse the f/h header records a conforming pager emits 2026-08-08 12:59:00 +02:00
attach.go Collapse the focused-main-view handler channels into one 2026-08-08 12:59:00 +02:00
base_controller.go Collapse the focused-main-view handler channels into one 2026-08-08 12:59:00 +02:00
basic_commits_controller.go Move the new-worktree keybinding from worktrees to universal 2026-07-03 18:53:05 +02:00
bisect_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
branches_controller.go Show a Github PR's combined checks state in branches list and main view 2026-08-02 13:06:21 +02:00
command_log_controller.go Remove return value of Focus-related functions 2024-09-06 08:45:48 +02:00
commit_description_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
commit_message_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
commits_files_controller.go Make the patch-building secondary pane's space remove the right lines, disable its discard 2026-08-08 12:59:00 +02:00
common.go lots of changes 2023-04-30 13:19:53 +10:00
confirmation_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
context_lines_controller.go Allow changing context size during custom patch building 2026-08-08 12:59:00 +02:00
custom_patch_options_menu_action.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
diffing_menu_action.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
edit_config_action.go Extract editConfig into a shared EditConfigAction 2026-06-24 22:03:57 +02:00
files_controller.go Advance to the next hunk after toggling one into a custom patch 2026-08-08 12:59:00 +02:00
filter_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
filtering_menu_action.go Handle entering and leaving filtering mode in one place 2026-08-05 17:29:20 +02:00
git_flow_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
global_controller.go Try yet another solution for the fight over the bg color (delta vs. selection) 2026-08-08 12:59:00 +02:00
jump_to_side_window_controller.go Stop requiring jumpToBlock to have exactly five entries 2026-06-23 14:15:18 +02:00
list_controller.go Keep range drags moving at panel edges 2026-07-31 08:32:43 +02:00
list_controller_trait.go Enable nolintlint linter, and fix warnings 2025-06-30 18:30:11 +02:00
local_commits_controller.go Render the custom-patch secondary pane through the pager, via a real git diff 2026-08-08 12:59:00 +02:00
local_commits_controller_test.go Drag selected commits to a new position 2026-07-31 08:37:28 +02:00
main_view_controller.go Parse the f/h header records a conforming pager emits 2026-08-08 12:59:00 +02:00
menu_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
menu_key.go Use a slice of keys for each binding 2026-05-25 15:18:18 +02:00
merge_conflicts_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
options_menu_action.go If a menu entry has multiple keybindings, list them in a tooltip 2026-05-25 15:32:47 +02:00
patch_building_controller.go Run the sync commit-surgery ops on a worker with input blocked 2026-07-17 12:32:32 +02:00
patch_building_from_main_view.go Advance to the next hunk after toggling one into a custom patch 2026-08-08 12:59:00 +02:00
patch_explorer_controller.go Recover diff-line identity by parsing the buffer, behind a swappable seam 2026-08-08 12:58:59 +02:00
patch_explorer_controller_test.go Strip the '+' and '-' characters when copying parts of a diff to the clipboard 2025-04-29 11:33:47 +02:00
prompt_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
quit_actions.go Refuse a repo switch while a foreground operation is in flight 2026-07-07 18:09:33 +02:00
reflog_commits_controller.go Extend the raw-diff fallback to the commit/stash/patch-building panels 2026-08-08 12:59:00 +02:00
remote_branches_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
remotes_controller.go Update comments that still describe the removed blocking refresh mode 2026-07-21 22:23:58 +02:00
remotes_controller_test.go feat: add fork remote command 2025-11-16 17:26:00 +01:00
rename_similarity_threshold_controller.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
screen_mode_actions.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
scroll_off_margin.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00
scroll_off_margin_test.go Add tests for scroll-off margin of zero 2023-08-21 08:10:28 +02:00
search_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
search_prompt_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
shell_command_action.go Strip leading/trailing whitespace from prompt input 2025-11-15 15:38:24 +01:00
side_window_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
snake_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
staging_controller.go Restore the focused main view by patch identity on escape 2026-08-08 12:58:59 +02:00
stash_controller.go Preserve the focused main view's selection across commit rewrites 2026-08-08 12:59:00 +02:00
status_controller.go Extract editConfig into a shared EditConfigAction 2026-06-24 22:03:57 +02:00
sub_commits_controller.go Preserve the focused main view's selection across commit rewrites 2026-08-08 12:59:00 +02:00
submodules_controller.go Fall back to the raw diff when focusing a main view under an unresolvable pager 2026-08-08 12:59:00 +02:00
suggestions_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
switch_to_diff_files_controller.go Make the patch-building secondary pane's space remove the right lines, disable its discard 2026-08-08 12:59:00 +02:00
switch_to_focused_main_view_controller.go Fall back to the raw diff when focusing a main view under an unresolvable pager 2026-08-08 12:59:00 +02:00
switch_to_sub_commits_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
sync_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
tags_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
toggle_whitespace_action.go Move IgnoreWhitespaceInDiffView to user config 2025-07-09 13:15:03 +02:00
undo_controller.go Capture the commits refresh's inputs on the UI thread 2026-07-07 18:10:45 +02:00
vertical_scroll_controller.go Read lines based on scroll position instead of a fixed per-notch delta 2026-07-09 09:32:35 +02:00
workspace_reset_controller.go Remove the RefreshMode field 2026-07-17 12:32:32 +02:00
worktrees_controller.go Offer to delete the branch when removing a worktree 2026-07-03 19:04:44 +02:00