jesseduffield.lazygit/pkg/gui/context
Stefan Haller 0b70dfbf46 Fix crash when filtering the keybindings menu
It would crash when some keybindings are set to null, and the filter string is
such that only those keybindings remain visible.

The reason for the crash is that when inserting non-model items (menu section
headers in this case) you specify a column to align them to. This works on the
assumption that the number of columns is always the same. It can cope with the
case that columns are removed because they are empty for all items; but it can't
cope with the case that the getDisplayStrings function returns a lower number of
columns.

And this is what happened here: MenuViewModel.GetDisplayStrings would omit the
keybinding column when none of the entries have a keybinding. This logic is
unnecessary, the generic list rendering mechanism takes care of this, so
removing this logic fixes the crash.

We do have to make sure though that the column is really empty when there's no
keybinding, so change the logic to use FgCyan only when there's a keybinding.
2024-03-28 09:58:45 +01:00
..
traits Set mode to none when calling SetSelectionRangeAndMode with empty non-sticky range 2024-03-16 22:01:13 +01:00
base_context.go Rerender certain views when their width changes 2023-10-16 09:03:07 +02:00
branches_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
commit_files_context.go Set groundwork for better disabled reasons with range select 2024-01-23 13:03:37 +11:00
commit_message_context.go Always show the "Press <c-o> to open menu" help text in the commit panel 2024-03-18 20:44:03 +01:00
confirmation_context.go split context common from helper common 2023-04-30 13:19:53 +10:00
context.go Layout the bottom line view using spacer views 2023-12-09 11:18:28 +01:00
context_common.go split context common from helper common 2023-04-30 13:19:53 +10:00
dynamic_title_builder.go show namesake for child views 2022-03-26 18:00:46 +11:00
filtered_list.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
filtered_list_view_model.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
history_trait.go Add search history 2023-09-20 08:35:41 +03:00
list_context_trait.go Disable range-select in menu and suggestions view 2024-01-19 10:50:49 +11:00
list_renderer.go Add a mechanism to insert non-model items into list contexts 2023-08-29 08:04:47 +02:00
list_renderer_test.go Set groundwork for better disabled reasons with range select 2024-01-23 13:03:37 +11:00
list_view_model.go Reduce the chance of race condition with list cursor 2024-01-28 09:20:52 +11:00
local_commits_context.go Rename showBranchMarkerForHeadCommit parameter to hasRebaseUpdateRefsConfig 2024-03-02 10:17:58 +01:00
menu_context.go Fix crash when filtering the keybindings menu 2024-03-28 09:58:45 +01:00
merge_conflicts_context.go Standardise display of range selection across views 2024-01-19 10:47:21 +11:00
parent_context_mgr.go refactor contexts code 2022-03-17 19:13:40 +11:00
patch_explorer_context.go Standardise display of range selection across views 2024-01-19 10:47:21 +11:00
reflog_commits_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
remote_branches_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
remotes_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
search_trait.go Don't select current search result when showing search status 2023-09-25 16:37:59 +10:00
setup.go Layout the bottom line view using spacer views 2023-12-09 11:18:28 +01:00
simple_context.go remove context callback opts 2023-04-30 13:19:53 +10:00
stash_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
sub_commits_context.go Rename showBranchMarkerForHeadCommit parameter to hasRebaseUpdateRefsConfig 2024-03-02 10:17:58 +01:00
submodules_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
suggestions_context.go Set groundwork for better disabled reasons with range select 2024-01-23 13:03:37 +11:00
tags_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00
view_trait.go Add range selection ability on list contexts 2024-01-19 10:47:21 +11:00
working_tree_context.go Set groundwork for better disabled reasons with range select 2024-01-23 13:03:37 +11:00
worktrees_context.go Get rid of the retain-sort-order-when-filtering logic again 2024-03-17 12:23:07 +01:00