1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

WIP constants for context keys

This commit is contained in:
Jesse Duffield
2020-08-20 09:00:55 +10:00
parent 146722beb8
commit 433d54fcec
4 changed files with 77 additions and 55 deletions

View File

@ -16,6 +16,28 @@ const (
func GetKindWrapper(k int) func() int { return func() int { return k } } func GetKindWrapper(k int) func() int { return func() int { return k } }
const (
STATUS_CONTEXT_KEY = "status"
FILES_CONTEXT_KEY = "files"
LOCAL_BRANCHES_CONTEXT_KEY = "localBranches"
REMOTES_CONTEXT_KEY = "remotes"
REMOTE_BRANCHES_CONTEXT_KEY = "remoteBranches"
TAGS_CONTEXT_KEY = "tags"
BRANCH_COMMITS_CONTEXT_KEY = "commits"
REFLOG_COMMITS_CONTEXT_KEY = "reflogCommits"
COMMIT_FILES_CONTEXT_KEY = "commitFiles"
STASH_CONTEXT_KEY = "stash"
MAIN_NORMAL_CONTEXT_KEY = "normal"
MAIN_MERGING_CONTEXT_KEY = "merging"
MAIN_PATCH_BUILDING_CONTEXT_KEY = "patchBuilding"
MAIN_STAGING_CONTEXT_KEY = "staging"
MENU_CONTEXT_KEY = "menu"
CREDENTIALS_CONTEXT_KEY = "credentials"
CONFIRMATION_CONTEXT_KEY = "confirmation"
SEARCH_CONTEXT_KEY = "confirmation"
COMMIT_MESSAGE_CONTEXT_KEY = "commitMessage"
)
type Context interface { type Context interface {
HandleFocus() error HandleFocus() error
HandleFocusLost() error HandleFocusLost() error
@ -232,7 +254,7 @@ func (gui *Gui) contextTree() ContextTree {
OnFocus: func() error { return gui.handleCommitMessageFocused() }, OnFocus: func() error { return gui.handleCommitMessageFocused() },
Kind: PERSISTENT_POPUP, Kind: PERSISTENT_POPUP,
ViewName: "commitMessage", ViewName: "commitMessage",
Key: "commit-message", // admittedly awkward to have view names in camelCase and contexts in kebab-case Key: "commitMessage",
}, },
}, },
Search: SimpleContextNode{ Search: SimpleContextNode{

View File

@ -46,12 +46,12 @@ func (gui *Gui) currentDiffTerminals() []string {
// not supporting files for now // not supporting files for now
case "commitFiles": case "commitFiles":
// not supporting commit files for now // not supporting commit files for now
case "branch-commits": case "branchCommits":
item := gui.getSelectedCommit() item := gui.getSelectedCommit()
if item != nil { if item != nil {
return []string{item.RefName()} return []string{item.RefName()}
} }
case "reflog-commits": case "reflogCommits":
item := gui.getSelectedReflogCommit() item := gui.getSelectedReflogCommit()
if item != nil { if item != nil {
return []string{item.RefName()} return []string{item.RefName()}
@ -62,7 +62,7 @@ func (gui *Gui) currentDiffTerminals() []string {
return []string{item.RefName()} return []string{item.RefName()}
} }
case "local-branches": case "localBranches":
branch := gui.getSelectedBranch() branch := gui.getSelectedBranch()
if branch != nil { if branch != nil {
names := []string{branch.RefName()} names := []string{branch.RefName()}
@ -77,7 +77,7 @@ func (gui *Gui) currentDiffTerminals() []string {
if item != nil { if item != nil {
return []string{item.RefName()} return []string{item.RefName()}
} }
case "remote-branches": case "remoteBranches":
item := gui.getSelectedRemoteBranch() item := gui.getSelectedRemoteBranch()
if item != nil { if item != nil {
return []string{item.RefName()} return []string{item.RefName()}

View File

@ -466,91 +466,91 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Handler: gui.handleBranchPress, Handler: gui.handleBranchPress,
Description: gui.Tr.SLocalize("checkout"), Description: gui.Tr.SLocalize("checkout"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.createPullRequest"), Key: gui.getKey("branches.createPullRequest"),
Handler: gui.handleCreatePullRequestPress, Handler: gui.handleCreatePullRequestPress,
Description: gui.Tr.SLocalize("createPullRequest"), Description: gui.Tr.SLocalize("createPullRequest"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.checkoutBranchByName"), Key: gui.getKey("branches.checkoutBranchByName"),
Handler: gui.handleCheckoutByName, Handler: gui.handleCheckoutByName,
Description: gui.Tr.SLocalize("checkoutByName"), Description: gui.Tr.SLocalize("checkoutByName"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.forceCheckoutBranch"), Key: gui.getKey("branches.forceCheckoutBranch"),
Handler: gui.handleForceCheckout, Handler: gui.handleForceCheckout,
Description: gui.Tr.SLocalize("forceCheckout"), Description: gui.Tr.SLocalize("forceCheckout"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Handler: gui.handleNewBranch, Handler: gui.handleNewBranch,
Description: gui.Tr.SLocalize("newBranch"), Description: gui.Tr.SLocalize("newBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Handler: gui.handleDeleteBranch, Handler: gui.handleDeleteBranch,
Description: gui.Tr.SLocalize("deleteBranch"), Description: gui.Tr.SLocalize("deleteBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.rebaseBranch"), Key: gui.getKey("branches.rebaseBranch"),
Handler: gui.handleRebaseOntoLocalBranch, Handler: gui.handleRebaseOntoLocalBranch,
Description: gui.Tr.SLocalize("rebaseBranch"), Description: gui.Tr.SLocalize("rebaseBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.mergeIntoCurrentBranch"), Key: gui.getKey("branches.mergeIntoCurrentBranch"),
Handler: gui.handleMerge, Handler: gui.handleMerge,
Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.viewGitFlowOptions"), Key: gui.getKey("branches.viewGitFlowOptions"),
Handler: gui.handleCreateGitFlowMenu, Handler: gui.handleCreateGitFlowMenu,
Description: gui.Tr.SLocalize("gitFlowOptions"), Description: gui.Tr.SLocalize("gitFlowOptions"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.FastForward"), Key: gui.getKey("branches.FastForward"),
Handler: gui.handleFastForward, Handler: gui.handleFastForward,
Description: gui.Tr.SLocalize("FastForward"), Description: gui.Tr.SLocalize("FastForward"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Handler: gui.handleCreateResetToBranchMenu, Handler: gui.handleCreateResetToBranchMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("branches.renameBranch"), Key: gui.getKey("branches.renameBranch"),
Handler: gui.handleRenameBranch, Handler: gui.handleRenameBranch,
Description: gui.Tr.SLocalize("renameBranch"), Description: gui.Tr.SLocalize("renameBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"localBranches"},
Key: gui.getKey("universal.copyToClipboard"), Key: gui.getKey("universal.copyToClipboard"),
Handler: gui.handleClipboardCopyBranch, Handler: gui.handleClipboardCopyBranch,
Description: gui.Tr.SLocalize("copyBranchNameToClipboard"), Description: gui.Tr.SLocalize("copyBranchNameToClipboard"),
@ -604,14 +604,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Handler: gui.handleRemoteBranchesEscape, Handler: gui.handleRemoteBranchesEscape,
Description: gui.Tr.SLocalize("ReturnToRemotesList"), Description: gui.Tr.SLocalize("ReturnToRemotesList"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Handler: gui.handleCreateResetToRemoteBranchMenu, Handler: gui.handleCreateResetToRemoteBranchMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
@ -637,147 +637,147 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.squashDown"), Key: gui.getKey("commits.squashDown"),
Handler: gui.handleCommitSquashDown, Handler: gui.handleCommitSquashDown,
Description: gui.Tr.SLocalize("squashDown"), Description: gui.Tr.SLocalize("squashDown"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.renameCommit"), Key: gui.getKey("commits.renameCommit"),
Handler: gui.handleRenameCommit, Handler: gui.handleRenameCommit,
Description: gui.Tr.SLocalize("renameCommit"), Description: gui.Tr.SLocalize("renameCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.renameCommitWithEditor"), Key: gui.getKey("commits.renameCommitWithEditor"),
Handler: gui.handleRenameCommitEditor, Handler: gui.handleRenameCommitEditor,
Description: gui.Tr.SLocalize("renameCommitEditor"), Description: gui.Tr.SLocalize("renameCommitEditor"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Handler: gui.handleCreateCommitResetMenu, Handler: gui.handleCreateCommitResetMenu,
Description: gui.Tr.SLocalize("resetToThisCommit"), Description: gui.Tr.SLocalize("resetToThisCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.markCommitAsFixup"), Key: gui.getKey("commits.markCommitAsFixup"),
Handler: gui.handleCommitFixup, Handler: gui.handleCommitFixup,
Description: gui.Tr.SLocalize("fixupCommit"), Description: gui.Tr.SLocalize("fixupCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.createFixupCommit"), Key: gui.getKey("commits.createFixupCommit"),
Handler: gui.handleCreateFixupCommit, Handler: gui.handleCreateFixupCommit,
Description: gui.Tr.SLocalize("createFixupCommit"), Description: gui.Tr.SLocalize("createFixupCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.squashAboveCommits"), Key: gui.getKey("commits.squashAboveCommits"),
Handler: gui.handleSquashAllAboveFixupCommits, Handler: gui.handleSquashAllAboveFixupCommits,
Description: gui.Tr.SLocalize("squashAboveCommits"), Description: gui.Tr.SLocalize("squashAboveCommits"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Handler: gui.handleCommitDelete, Handler: gui.handleCommitDelete,
Description: gui.Tr.SLocalize("deleteCommit"), Description: gui.Tr.SLocalize("deleteCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.moveDownCommit"), Key: gui.getKey("commits.moveDownCommit"),
Handler: gui.handleCommitMoveDown, Handler: gui.handleCommitMoveDown,
Description: gui.Tr.SLocalize("moveDownCommit"), Description: gui.Tr.SLocalize("moveDownCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.moveUpCommit"), Key: gui.getKey("commits.moveUpCommit"),
Handler: gui.handleCommitMoveUp, Handler: gui.handleCommitMoveUp,
Description: gui.Tr.SLocalize("moveUpCommit"), Description: gui.Tr.SLocalize("moveUpCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Handler: gui.handleCommitEdit, Handler: gui.handleCommitEdit,
Description: gui.Tr.SLocalize("editCommit"), Description: gui.Tr.SLocalize("editCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.amendToCommit"), Key: gui.getKey("commits.amendToCommit"),
Handler: gui.handleCommitAmendTo, Handler: gui.handleCommitAmendTo,
Description: gui.Tr.SLocalize("amendToCommit"), Description: gui.Tr.SLocalize("amendToCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.pickCommit"), Key: gui.getKey("commits.pickCommit"),
Handler: gui.handleCommitPick, Handler: gui.handleCommitPick,
Description: gui.Tr.SLocalize("pickCommit"), Description: gui.Tr.SLocalize("pickCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.revertCommit"), Key: gui.getKey("commits.revertCommit"),
Handler: gui.handleCommitRevert, Handler: gui.handleCommitRevert,
Description: gui.Tr.SLocalize("revertCommit"), Description: gui.Tr.SLocalize("revertCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.cherryPickCopy"), Key: gui.getKey("commits.cherryPickCopy"),
Handler: gui.handleCopyCommit, Handler: gui.handleCopyCommit,
Description: gui.Tr.SLocalize("cherryPickCopy"), Description: gui.Tr.SLocalize("cherryPickCopy"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("universal.copyToClipboard"), Key: gui.getKey("universal.copyToClipboard"),
Handler: gui.handleClipboardCopyCommit, Handler: gui.handleClipboardCopyCommit,
Description: gui.Tr.SLocalize("copyCommitShaToClipboard"), Description: gui.Tr.SLocalize("copyCommitShaToClipboard"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.cherryPickCopyRange"), Key: gui.getKey("commits.cherryPickCopyRange"),
Handler: gui.handleCopyCommitRange, Handler: gui.handleCopyCommitRange,
Description: gui.Tr.SLocalize("cherryPickCopyRange"), Description: gui.Tr.SLocalize("cherryPickCopyRange"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.pasteCommits"), Key: gui.getKey("commits.pasteCommits"),
Handler: gui.HandlePasteCommits, Handler: gui.HandlePasteCommits,
Description: gui.Tr.SLocalize("pasteCommits"), Description: gui.Tr.SLocalize("pasteCommits"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("universal.goInto"), Key: gui.getKey("universal.goInto"),
Handler: gui.wrappedHandler(gui.handleSwitchToCommitFilesPanel), Handler: gui.wrappedHandler(gui.handleSwitchToCommitFilesPanel),
Description: gui.Tr.SLocalize("viewCommitFiles"), Description: gui.Tr.SLocalize("viewCommitFiles"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.checkoutCommit"), Key: gui.getKey("commits.checkoutCommit"),
Handler: gui.handleCheckoutCommit, Handler: gui.handleCheckoutCommit,
Description: gui.Tr.SLocalize("checkoutCommit"), Description: gui.Tr.SLocalize("checkoutCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: gui.wrappedHandler(gui.handleNewBranchOffCommit), Handler: gui.wrappedHandler(gui.handleNewBranchOffCommit),
@ -785,28 +785,28 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.tagCommit"), Key: gui.getKey("commits.tagCommit"),
Handler: gui.handleTagCommit, Handler: gui.handleTagCommit,
Description: gui.Tr.SLocalize("tagCommit"), Description: gui.Tr.SLocalize("tagCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branchCommits"},
Key: gui.getKey("commits.resetCherryPick"), Key: gui.getKey("commits.resetCherryPick"),
Handler: gui.handleResetCherryPick, Handler: gui.handleResetCherryPick,
Description: gui.Tr.SLocalize("resetCherryPick"), Description: gui.Tr.SLocalize("resetCherryPick"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"reflog-commits"}, Contexts: []string{"reflogCommits"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Handler: gui.handleCheckoutReflogCommit, Handler: gui.handleCheckoutReflogCommit,
Description: gui.Tr.SLocalize("checkoutCommit"), Description: gui.Tr.SLocalize("checkoutCommit"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"reflog-commits"}, Contexts: []string{"reflogCommits"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Handler: gui.handleCreateReflogResetMenu, Handler: gui.handleCreateReflogResetMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
@ -1300,14 +1300,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Handler: gui.handleCheckoutRemoteBranch, Handler: gui.handleCheckoutRemoteBranch,
Description: gui.Tr.SLocalize("checkout"), Description: gui.Tr.SLocalize("checkout"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Handler: gui.handleNewBranchOffRemote, Handler: gui.handleNewBranchOffRemote,
Description: gui.Tr.SLocalize("newBranch"), Description: gui.Tr.SLocalize("newBranch"),
@ -1315,28 +1315,28 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("branches.mergeIntoCurrentBranch"), Key: gui.getKey("branches.mergeIntoCurrentBranch"),
Handler: gui.handleMergeRemoteBranch, Handler: gui.handleMergeRemoteBranch,
Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Handler: gui.handleDeleteRemoteBranch, Handler: gui.handleDeleteRemoteBranch,
Description: gui.Tr.SLocalize("deleteBranch"), Description: gui.Tr.SLocalize("deleteBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("branches.rebaseBranch"), Key: gui.getKey("branches.rebaseBranch"),
Handler: gui.handleRebaseOntoRemoteBranch, Handler: gui.handleRebaseOntoRemoteBranch,
Description: gui.Tr.SLocalize("rebaseBranch"), Description: gui.Tr.SLocalize("rebaseBranch"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remoteBranches"},
Key: gui.getKey("branches.setUpstream"), Key: gui.getKey("branches.setUpstream"),
Handler: gui.handleSetBranchUpstream, Handler: gui.handleSetBranchUpstream,
Description: gui.Tr.SLocalize("setUpstream"), Description: gui.Tr.SLocalize("setUpstream"),

View File

@ -248,7 +248,7 @@ func (gui *Gui) filesListContext() *ListContext {
func (gui *Gui) branchesListContext() *ListContext { func (gui *Gui) branchesListContext() *ListContext {
return &ListContext{ return &ListContext{
ViewName: "branches", ViewName: "branches",
ContextKey: "local-branches", ContextKey: "localBranches",
GetItemsLength: func() int { return len(gui.State.Branches) }, GetItemsLength: func() int { return len(gui.State.Branches) },
GetPanelState: func() IListPanelState { return gui.State.Panels.Branches }, GetPanelState: func() IListPanelState { return gui.State.Panels.Branches },
OnFocus: gui.handleBranchSelect, OnFocus: gui.handleBranchSelect,
@ -281,7 +281,7 @@ func (gui *Gui) remotesListContext() *ListContext {
func (gui *Gui) remoteBranchesListContext() *ListContext { func (gui *Gui) remoteBranchesListContext() *ListContext {
return &ListContext{ return &ListContext{
ViewName: "branches", ViewName: "branches",
ContextKey: "remote-branches", ContextKey: "remoteBranches",
GetItemsLength: func() int { return len(gui.State.RemoteBranches) }, GetItemsLength: func() int { return len(gui.State.RemoteBranches) },
GetPanelState: func() IListPanelState { return gui.State.Panels.RemoteBranches }, GetPanelState: func() IListPanelState { return gui.State.Panels.RemoteBranches },
OnFocus: gui.handleRemoteBranchSelect, OnFocus: gui.handleRemoteBranchSelect,
@ -313,7 +313,7 @@ func (gui *Gui) tagsListContext() *ListContext {
func (gui *Gui) branchCommitsListContext() *ListContext { func (gui *Gui) branchCommitsListContext() *ListContext {
return &ListContext{ return &ListContext{
ViewName: "commits", ViewName: "commits",
ContextKey: "branch-commits", ContextKey: "branchCommits",
GetItemsLength: func() int { return len(gui.State.Commits) }, GetItemsLength: func() int { return len(gui.State.Commits) },
GetPanelState: func() IListPanelState { return gui.State.Panels.Commits }, GetPanelState: func() IListPanelState { return gui.State.Panels.Commits },
OnFocus: gui.handleCommitSelect, OnFocus: gui.handleCommitSelect,
@ -330,7 +330,7 @@ func (gui *Gui) branchCommitsListContext() *ListContext {
func (gui *Gui) reflogCommitsListContext() *ListContext { func (gui *Gui) reflogCommitsListContext() *ListContext {
return &ListContext{ return &ListContext{
ViewName: "commits", ViewName: "commits",
ContextKey: "reflog-commits", ContextKey: "reflogCommits",
GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) }, GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) },
GetPanelState: func() IListPanelState { return gui.State.Panels.ReflogCommits }, GetPanelState: func() IListPanelState { return gui.State.Panels.ReflogCommits },
OnFocus: gui.handleReflogCommitSelect, OnFocus: gui.handleReflogCommitSelect,