Repository: jesseduffield/lazygit
File: pkg/gui/views.go (Go)

Code before:
	gui.Views.Limit.Title = gui.c.Tr.NotEnoughSpace
	gui.Views.Status.Title = gui.c.Tr.StatusTitle
	gui.Views.Staging.Title = gui.c.Tr.UnstagedChanges
	gui.Views.StagingSecondary.Title = gui.c.Tr.StagedChanges
	gui.Views.CommitMessage.Title = gui.c.Tr.CommitSummary
	gui.Views.CommitDescription.Title = gui.c.Tr.CommitDescriptionTitle
	gui.Views.Extras.Title = gui.c.Tr.CommandLog
	gui.Views.Snake.Title = gui.c.Tr.SnakeTitle

	for _, view := range []*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Staging, gui.Views.StagingSecondary, gui.Views.PatchBuilding, gui.Views.PatchBuildingSecondary, gui.Views.MergeConflicts} {
		view.Title = gui.c.Tr.DiffTitle
		view.CanScrollPastBottom = gui.c.UserConfig().Gui.ScrollPastBottom
		view.TabWidth = gui.c.UserConfig().Gui.TabWidth
	}

	gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
	gui.Views.CommitDescription.TextArea.AutoWrap = gui.c.UserConfig().Git.Commit.AutoWrapCommitMessage
	gui.Views.CommitDescription.TextArea.AutoWrapWidth = gui.c.UserConfig().Git.Commit.AutoWrapWidth

	if gui.c.UserConfig().Gui.ShowPanelJumps {
		keyToTitlePrefix := func(key string) string {
			if key == "<disabled>" {
				return ""
			}
			return fmt.Sprintf("[%s]", key)
		}
		jumpBindings := gui.c.UserConfig().Keybinding.Universal.JumpToBlock
		jumpLabels := lo.Map(jumpBindings, func(binding string, _ int) string {
			return keyToTitlePrefix(binding)
		})

		gui.Views.Status.TitlePrefix = jumpLabels[0]

		gui.Views.Files.TitlePrefix = jumpLabels[1]
		gui.Views.Worktrees.TitlePrefix = jumpLabels[1]
		gui.Views.Submodules.TitlePrefix = jumpLabels[1]

		gui.Views.Branches.TitlePrefix = jumpLabels[2]
		gui.Views.Remotes.TitlePrefix = jumpLabels[2]
		gui.Views.Tags.TitlePrefix = jumpLabels[2]

		gui.Views.Commits.TitlePrefix = jumpLabels[3]
		gui.Views.ReflogCommits.TitlePrefix = jumpLabels[3]

		gui.Views.Stash.TitlePrefix = jumpLabels[4]
	} else {
		gui.Views.Status.TitlePrefix = ""

		gui.Views.Files.TitlePrefix = ""
		gui.Views.Worktrees.TitlePrefix = ""
		gui.Views.Submodules.TitlePrefix = ""

Review comment (suggestion):
> Fix display of panel jump keys for disabled bindings
> \- _commit subject_

hi!

this handles the corresponding in this section from config docs, right?

https://github.com/jesseduffield/lazygit/blob/143d4760fd82d526b49671fc91be20ef12127a77/docs/Config.md#L963-L969

<!--
this is a bit unclear.  what are we talking about?  the panel or the bindings :sweat_smile: or did it mean disabled heading?
 -->

Code after:
	gui.Views.Limit.Title = gui.c.Tr.NotEnoughSpace
	gui.Views.Status.Title = gui.c.Tr.StatusTitle
	gui.Views.Staging.Title = gui.c.Tr.UnstagedChanges
	gui.Views.StagingSecondary.Title = gui.c.Tr.StagedChanges
	gui.Views.CommitMessage.Title = gui.c.Tr.CommitSummary
	gui.Views.CommitDescription.Title = gui.c.Tr.CommitDescriptionTitle
	gui.Views.Extras.Title = gui.c.Tr.CommandLog
	gui.Views.Snake.Title = gui.c.Tr.SnakeTitle

	for _, view := range []*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Staging, gui.Views.StagingSecondary, gui.Views.PatchBuilding, gui.Views.PatchBuildingSecondary, gui.Views.MergeConflicts} {
		view.Title = gui.c.Tr.DiffTitle
		view.CanScrollPastBottom = gui.c.UserConfig().Gui.ScrollPastBottom
		view.TabWidth = gui.c.UserConfig().Gui.TabWidth
	}

	gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
	gui.Views.CommitDescription.TextArea.AutoWrap = gui.c.UserConfig().Git.Commit.AutoWrapCommitMessage
	gui.Views.CommitDescription.TextArea.AutoWrapWidth = gui.c.UserConfig().Git.Commit.AutoWrapWidth

	if gui.c.UserConfig().Gui.ShowPanelJumps {
		keyToTitlePrefix := func(key string) string {
			if key == "<disabled>" {
				return ""
			}
			return fmt.Sprintf("[%s]", key)
		}
		jumpBindings := gui.c.UserConfig().Keybinding.Universal.JumpToBlock
		jumpLabels := lo.Map(jumpBindings, func(binding string, _ int) string {
			return keyToTitlePrefix(binding)
		})

		gui.Views.Status.TitlePrefix = jumpLabels[0]

		gui.Views.Files.TitlePrefix = jumpLabels[1]
		gui.Views.Worktrees.TitlePrefix = jumpLabels[1]
		gui.Views.Submodules.TitlePrefix = jumpLabels[1]

		gui.Views.Branches.TitlePrefix = jumpLabels[2]
		gui.Views.Remotes.TitlePrefix = jumpLabels[2]
		gui.Views.Tags.TitlePrefix = jumpLabels[2]

		gui.Views.Commits.TitlePrefix = jumpLabels[3]
		gui.Views.ReflogCommits.TitlePrefix = jumpLabels[3]

		gui.Views.Stash.TitlePrefix = jumpLabels[4]

		gui.Views.Main.TitlePrefix = keyToTitlePrefix(gui.c.UserConfig().Keybinding.Universal.FocusMainView)
	} else {
		gui.Views.Status.TitlePrefix = ""

		gui.Views.Files.TitlePrefix = ""