mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
move context keys into context package
This commit is contained in:
parent
138be04e65
commit
e363606fb6
19 changed files with 257 additions and 243 deletions
|
@ -2,6 +2,7 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/boxlayout"
|
"github.com/jesseduffield/lazygit/pkg/gui/boxlayout"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
@ -139,7 +140,7 @@ func (gui *Gui) getExtrasWindowSize(screenHeight int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseSize int
|
var baseSize int
|
||||||
if gui.currentStaticContext().GetKey() == COMMAND_LOG_CONTEXT_KEY {
|
if gui.currentStaticContext().GetKey() == context.COMMAND_LOG_CONTEXT_KEY {
|
||||||
baseSize = 1000 // my way of saying 'fill the available space'
|
baseSize = 1000 // my way of saying 'fill the available space'
|
||||||
} else if screenHeight < 40 {
|
} else if screenHeight < 40 {
|
||||||
baseSize = 1
|
baseSize = 1
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers"
|
"github.com/jesseduffield/lazygit/pkg/gui/controllers"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
|
@ -409,9 +410,9 @@ func (gui *Gui) handleRenameBranch() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleNewBranchOffCurrentItem() error {
|
func (gui *Gui) handleNewBranchOffCurrentItem() error {
|
||||||
context := gui.currentSideListContext()
|
ctx := gui.currentSideListContext()
|
||||||
|
|
||||||
item, ok := context.GetSelectedItem()
|
item, ok := ctx.GetSelectedItem()
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -424,7 +425,7 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error {
|
||||||
)
|
)
|
||||||
|
|
||||||
prefilledName := ""
|
prefilledName := ""
|
||||||
if context.GetKey() == REMOTE_BRANCHES_CONTEXT_KEY {
|
if ctx.GetKey() == context.REMOTE_BRANCHES_CONTEXT_KEY {
|
||||||
// will set to the remote's branch name without the remote name
|
// will set to the remote's branch name without the remote name
|
||||||
prefilledName = strings.SplitAfterN(item.ID(), "/", 2)[1]
|
prefilledName = strings.SplitAfterN(item.ID(), "/", 2)[1]
|
||||||
}
|
}
|
||||||
|
@ -440,11 +441,11 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error {
|
||||||
|
|
||||||
// if we're currently in the branch commits context then the selected commit
|
// if we're currently in the branch commits context then the selected commit
|
||||||
// is about to go to the top of the list
|
// is about to go to the top of the list
|
||||||
if context.GetKey() == BRANCH_COMMITS_CONTEXT_KEY {
|
if ctx.GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
||||||
context.GetPanelState().SetSelectedLineIdx(0)
|
ctx.GetPanelState().SetSelectedLineIdx(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if context.GetKey() != gui.State.Contexts.Branches.GetKey() {
|
if ctx.GetKey() != gui.State.Contexts.Branches.GetKey() {
|
||||||
if err := gui.c.PushContext(gui.State.Contexts.Branches); err != nil {
|
if err := gui.c.PushContext(gui.State.Contexts.Branches); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,21 +63,21 @@ func (gui *Gui) cherryPickedCommitShaMap() map[string]bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) commitsListForContext() []*models.Commit {
|
func (gui *Gui) commitsListForContext() []*models.Commit {
|
||||||
context := gui.currentSideListContext()
|
ctx := gui.currentSideListContext()
|
||||||
if context == nil {
|
if ctx == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// using a switch statement, but we should use polymorphism
|
// using a switch statement, but we should use polymorphism
|
||||||
switch context.GetKey() {
|
switch ctx.GetKey() {
|
||||||
case BRANCH_COMMITS_CONTEXT_KEY:
|
case context.BRANCH_COMMITS_CONTEXT_KEY:
|
||||||
return gui.State.Commits
|
return gui.State.Commits
|
||||||
case REFLOG_COMMITS_CONTEXT_KEY:
|
case context.REFLOG_COMMITS_CONTEXT_KEY:
|
||||||
return gui.State.FilteredReflogCommits
|
return gui.State.FilteredReflogCommits
|
||||||
case SUB_COMMITS_CONTEXT_KEY:
|
case context.SUB_COMMITS_CONTEXT_KEY:
|
||||||
return gui.State.SubCommits
|
return gui.State.SubCommits
|
||||||
default:
|
default:
|
||||||
gui.c.Log.Errorf("no commit list for context %s", context.GetKey())
|
gui.c.Log.Errorf("no commit list for context %s", ctx.GetKey())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package gui
|
||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/patch"
|
"github.com/jesseduffield/lazygit/pkg/commands/patch"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers"
|
"github.com/jesseduffield/lazygit/pkg/gui/controllers"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
|
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
@ -100,7 +101,7 @@ func (gui *Gui) handleDiscardOldFileChange() error {
|
||||||
|
|
||||||
func (gui *Gui) refreshCommitFilesView() error {
|
func (gui *Gui) refreshCommitFilesView() error {
|
||||||
currentSideContext := gui.currentSideContext()
|
currentSideContext := gui.currentSideContext()
|
||||||
if currentSideContext.GetKey() == COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == BRANCH_COMMITS_CONTEXT_KEY {
|
if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
||||||
if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
|
if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -91,8 +92,8 @@ func (gui *Gui) refreshCommits() {
|
||||||
|
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
_ = gui.refreshCommitsWithLimit()
|
_ = gui.refreshCommitsWithLimit()
|
||||||
context, ok := gui.State.Contexts.CommitFiles.GetParentContext()
|
ctx, ok := gui.State.Contexts.CommitFiles.GetParentContext()
|
||||||
if ok && context.GetKey() == BRANCH_COMMITS_CONTEXT_KEY {
|
if ok && ctx.GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
||||||
// This makes sense when we've e.g. just amended a commit, meaning we get a new commit SHA at the same position.
|
// This makes sense when we've e.g. just amended a commit, meaning we get a new commit SHA at the same position.
|
||||||
// However if we've just added a brand new commit, it pushes the list down by one and so we would end up
|
// However if we've just added a brand new commit, it pushes the list down by one and so we would end up
|
||||||
// showing the contents of a different commit than the one we initially entered.
|
// showing the contents of a different commit than the one we initially entered.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/popup"
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/theme"
|
"github.com/jesseduffield/lazygit/pkg/theme"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
|
@ -138,7 +138,7 @@ func (gui *Gui) prepareConfirmationPanel(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) createPopupPanel(opts popup.CreatePopupPanelOpts) error {
|
func (gui *Gui) createPopupPanel(opts types.CreatePopupPanelOpts) error {
|
||||||
// remove any previous keybindings
|
// remove any previous keybindings
|
||||||
gui.clearConfirmationViewKeyBindings()
|
gui.clearConfirmationViewKeyBindings()
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ func (gui *Gui) createPopupPanel(opts popup.CreatePopupPanelOpts) error {
|
||||||
return gui.c.PushContext(gui.State.Contexts.Confirmation)
|
return gui.c.PushContext(gui.State.Contexts.Confirmation)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) setKeyBindings(opts popup.CreatePopupPanelOpts) error {
|
func (gui *Gui) setKeyBindings(opts types.CreatePopupPanelOpts) error {
|
||||||
actions := utils.ResolvePlaceholderString(
|
actions := utils.ResolvePlaceholderString(
|
||||||
gui.c.Tr.CloseConfirm,
|
gui.c.Tr.CloseConfirm,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
|
@ -201,25 +201,25 @@ func (gui *Gui) setKeyBindings(opts popup.CreatePopupPanelOpts) error {
|
||||||
bindings := []*types.Binding{
|
bindings := []*types.Binding{
|
||||||
{
|
{
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.Confirm),
|
Key: gui.getKey(keybindingConfig.Universal.Confirm),
|
||||||
Handler: onConfirm,
|
Handler: onConfirm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1),
|
Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1),
|
||||||
Handler: onConfirm,
|
Handler: onConfirm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.Return),
|
Key: gui.getKey(keybindingConfig.Universal.Return),
|
||||||
Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose),
|
Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.TogglePanel),
|
Key: gui.getKey(keybindingConfig.Universal.TogglePanel),
|
||||||
Handler: func() error {
|
Handler: func() error {
|
||||||
if len(gui.State.Suggestions) > 0 {
|
if len(gui.State.Suggestions) > 0 {
|
||||||
|
@ -230,25 +230,25 @@ func (gui *Gui) setKeyBindings(opts popup.CreatePopupPanelOpts) error {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "suggestions",
|
ViewName: "suggestions",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.Confirm),
|
Key: gui.getKey(keybindingConfig.Universal.Confirm),
|
||||||
Handler: onSuggestionConfirm,
|
Handler: onSuggestionConfirm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "suggestions",
|
ViewName: "suggestions",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1),
|
Key: gui.getKey(keybindingConfig.Universal.ConfirmAlt1),
|
||||||
Handler: onSuggestionConfirm,
|
Handler: onSuggestionConfirm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "suggestions",
|
ViewName: "suggestions",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.Return),
|
Key: gui.getKey(keybindingConfig.Universal.Return),
|
||||||
Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose),
|
Handler: gui.wrappedConfirmationFunction(opts.HandlersManageFocus, opts.HandleClose),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "suggestions",
|
ViewName: "suggestions",
|
||||||
Contexts: []string{string(CONFIRMATION_CONTEXT_KEY)},
|
Contexts: []string{string(context.CONFIRMATION_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(keybindingConfig.Universal.TogglePanel),
|
Key: gui.getKey(keybindingConfig.Universal.TogglePanel),
|
||||||
Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) },
|
Handler: func() error { return gui.replaceContext(gui.State.Contexts.Confirmation) },
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -130,7 +131,7 @@ func (gui *Gui) deactivateContext(c types.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are the kind of context that is sent to back upon deactivation, we should do that
|
// if we are the kind of context that is sent to back upon deactivation, we should do that
|
||||||
if view != nil && (c.GetKind() == types.TEMPORARY_POPUP || c.GetKind() == types.PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY) {
|
if view != nil && (c.GetKind() == types.TEMPORARY_POPUP || c.GetKind() == types.PERSISTENT_POPUP || c.GetKey() == context.COMMIT_FILES_CONTEXT_KEY) {
|
||||||
view.Visible = false
|
view.Visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ func (gui *Gui) activateContext(c types.Context, opts ...types.OnFocusOpts) erro
|
||||||
if viewName == "main" {
|
if viewName == "main" {
|
||||||
gui.changeMainViewsContext(c.GetKey())
|
gui.changeMainViewsContext(c.GetKey())
|
||||||
} else {
|
} else {
|
||||||
gui.changeMainViewsContext(MAIN_NORMAL_CONTEXT_KEY)
|
gui.changeMainViewsContext(context.MAIN_NORMAL_CONTEXT_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.setViewTabForContext(c)
|
gui.setViewTabForContext(c)
|
||||||
|
@ -382,7 +383,7 @@ func (gui *Gui) changeMainViewsContext(contextKey types.ContextKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch contextKey {
|
switch contextKey {
|
||||||
case MAIN_NORMAL_CONTEXT_KEY, MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY, MAIN_MERGING_CONTEXT_KEY:
|
case context.MAIN_NORMAL_CONTEXT_KEY, context.MAIN_PATCH_BUILDING_CONTEXT_KEY, context.MAIN_STAGING_CONTEXT_KEY, context.MAIN_MERGING_CONTEXT_KEY:
|
||||||
gui.Views.Main.Context = string(contextKey)
|
gui.Views.Main.Context = string(contextKey)
|
||||||
gui.Views.Secondary.Context = string(contextKey)
|
gui.Views.Secondary.Context = string(contextKey)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2,6 +2,58 @@ package context
|
||||||
|
|
||||||
import "github.com/jesseduffield/lazygit/pkg/gui/types"
|
import "github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
|
||||||
|
const (
|
||||||
|
STATUS_CONTEXT_KEY types.ContextKey = "status"
|
||||||
|
FILES_CONTEXT_KEY types.ContextKey = "files"
|
||||||
|
LOCAL_BRANCHES_CONTEXT_KEY types.ContextKey = "localBranches"
|
||||||
|
REMOTES_CONTEXT_KEY types.ContextKey = "remotes"
|
||||||
|
REMOTE_BRANCHES_CONTEXT_KEY types.ContextKey = "remoteBranches"
|
||||||
|
TAGS_CONTEXT_KEY types.ContextKey = "tags"
|
||||||
|
BRANCH_COMMITS_CONTEXT_KEY types.ContextKey = "commits"
|
||||||
|
REFLOG_COMMITS_CONTEXT_KEY types.ContextKey = "reflogCommits"
|
||||||
|
SUB_COMMITS_CONTEXT_KEY types.ContextKey = "subCommits"
|
||||||
|
COMMIT_FILES_CONTEXT_KEY types.ContextKey = "commitFiles"
|
||||||
|
STASH_CONTEXT_KEY types.ContextKey = "stash"
|
||||||
|
MAIN_NORMAL_CONTEXT_KEY types.ContextKey = "normal"
|
||||||
|
MAIN_MERGING_CONTEXT_KEY types.ContextKey = "merging"
|
||||||
|
MAIN_PATCH_BUILDING_CONTEXT_KEY types.ContextKey = "patchBuilding"
|
||||||
|
MAIN_STAGING_CONTEXT_KEY types.ContextKey = "staging"
|
||||||
|
MENU_CONTEXT_KEY types.ContextKey = "menu"
|
||||||
|
CREDENTIALS_CONTEXT_KEY types.ContextKey = "credentials"
|
||||||
|
CONFIRMATION_CONTEXT_KEY types.ContextKey = "confirmation"
|
||||||
|
SEARCH_CONTEXT_KEY types.ContextKey = "search"
|
||||||
|
COMMIT_MESSAGE_CONTEXT_KEY types.ContextKey = "commitMessage"
|
||||||
|
SUBMODULES_CONTEXT_KEY types.ContextKey = "submodules"
|
||||||
|
SUGGESTIONS_CONTEXT_KEY types.ContextKey = "suggestions"
|
||||||
|
COMMAND_LOG_CONTEXT_KEY types.ContextKey = "cmdLog"
|
||||||
|
)
|
||||||
|
|
||||||
|
var AllContextKeys = []types.ContextKey{
|
||||||
|
STATUS_CONTEXT_KEY,
|
||||||
|
FILES_CONTEXT_KEY,
|
||||||
|
LOCAL_BRANCHES_CONTEXT_KEY,
|
||||||
|
REMOTES_CONTEXT_KEY,
|
||||||
|
REMOTE_BRANCHES_CONTEXT_KEY,
|
||||||
|
TAGS_CONTEXT_KEY,
|
||||||
|
BRANCH_COMMITS_CONTEXT_KEY,
|
||||||
|
REFLOG_COMMITS_CONTEXT_KEY,
|
||||||
|
SUB_COMMITS_CONTEXT_KEY,
|
||||||
|
COMMIT_FILES_CONTEXT_KEY,
|
||||||
|
STASH_CONTEXT_KEY,
|
||||||
|
MAIN_NORMAL_CONTEXT_KEY,
|
||||||
|
MAIN_MERGING_CONTEXT_KEY,
|
||||||
|
MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
||||||
|
MAIN_STAGING_CONTEXT_KEY,
|
||||||
|
MENU_CONTEXT_KEY,
|
||||||
|
CREDENTIALS_CONTEXT_KEY,
|
||||||
|
CONFIRMATION_CONTEXT_KEY,
|
||||||
|
SEARCH_CONTEXT_KEY,
|
||||||
|
COMMIT_MESSAGE_CONTEXT_KEY,
|
||||||
|
SUBMODULES_CONTEXT_KEY,
|
||||||
|
SUGGESTIONS_CONTEXT_KEY,
|
||||||
|
COMMAND_LOG_CONTEXT_KEY,
|
||||||
|
}
|
||||||
|
|
||||||
type ContextTree struct {
|
type ContextTree struct {
|
||||||
Status types.Context
|
Status types.Context
|
||||||
Files types.IListContext
|
Files types.IListContext
|
||||||
|
|
|
@ -5,58 +5,6 @@ import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
STATUS_CONTEXT_KEY types.ContextKey = "status"
|
|
||||||
FILES_CONTEXT_KEY types.ContextKey = "files"
|
|
||||||
LOCAL_BRANCHES_CONTEXT_KEY types.ContextKey = "localBranches"
|
|
||||||
REMOTES_CONTEXT_KEY types.ContextKey = "remotes"
|
|
||||||
REMOTE_BRANCHES_CONTEXT_KEY types.ContextKey = "remoteBranches"
|
|
||||||
TAGS_CONTEXT_KEY types.ContextKey = "tags"
|
|
||||||
BRANCH_COMMITS_CONTEXT_KEY types.ContextKey = "commits"
|
|
||||||
REFLOG_COMMITS_CONTEXT_KEY types.ContextKey = "reflogCommits"
|
|
||||||
SUB_COMMITS_CONTEXT_KEY types.ContextKey = "subCommits"
|
|
||||||
COMMIT_FILES_CONTEXT_KEY types.ContextKey = "commitFiles"
|
|
||||||
STASH_CONTEXT_KEY types.ContextKey = "stash"
|
|
||||||
MAIN_NORMAL_CONTEXT_KEY types.ContextKey = "normal"
|
|
||||||
MAIN_MERGING_CONTEXT_KEY types.ContextKey = "merging"
|
|
||||||
MAIN_PATCH_BUILDING_CONTEXT_KEY types.ContextKey = "patchBuilding"
|
|
||||||
MAIN_STAGING_CONTEXT_KEY types.ContextKey = "staging"
|
|
||||||
MENU_CONTEXT_KEY types.ContextKey = "menu"
|
|
||||||
CREDENTIALS_CONTEXT_KEY types.ContextKey = "credentials"
|
|
||||||
CONFIRMATION_CONTEXT_KEY types.ContextKey = "confirmation"
|
|
||||||
SEARCH_CONTEXT_KEY types.ContextKey = "search"
|
|
||||||
COMMIT_MESSAGE_CONTEXT_KEY types.ContextKey = "commitMessage"
|
|
||||||
SUBMODULES_CONTEXT_KEY types.ContextKey = "submodules"
|
|
||||||
SUGGESTIONS_CONTEXT_KEY types.ContextKey = "suggestions"
|
|
||||||
COMMAND_LOG_CONTEXT_KEY types.ContextKey = "cmdLog"
|
|
||||||
)
|
|
||||||
|
|
||||||
var AllContextKeys = []types.ContextKey{
|
|
||||||
STATUS_CONTEXT_KEY,
|
|
||||||
FILES_CONTEXT_KEY,
|
|
||||||
LOCAL_BRANCHES_CONTEXT_KEY,
|
|
||||||
REMOTES_CONTEXT_KEY,
|
|
||||||
REMOTE_BRANCHES_CONTEXT_KEY,
|
|
||||||
TAGS_CONTEXT_KEY,
|
|
||||||
BRANCH_COMMITS_CONTEXT_KEY,
|
|
||||||
REFLOG_COMMITS_CONTEXT_KEY,
|
|
||||||
SUB_COMMITS_CONTEXT_KEY,
|
|
||||||
COMMIT_FILES_CONTEXT_KEY,
|
|
||||||
STASH_CONTEXT_KEY,
|
|
||||||
MAIN_NORMAL_CONTEXT_KEY,
|
|
||||||
MAIN_MERGING_CONTEXT_KEY,
|
|
||||||
MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
|
||||||
MAIN_STAGING_CONTEXT_KEY,
|
|
||||||
MENU_CONTEXT_KEY,
|
|
||||||
CREDENTIALS_CONTEXT_KEY,
|
|
||||||
CONFIRMATION_CONTEXT_KEY,
|
|
||||||
SEARCH_CONTEXT_KEY,
|
|
||||||
COMMIT_MESSAGE_CONTEXT_KEY,
|
|
||||||
SUBMODULES_CONTEXT_KEY,
|
|
||||||
SUGGESTIONS_CONTEXT_KEY,
|
|
||||||
COMMAND_LOG_CONTEXT_KEY,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gui *Gui) allContexts() []types.Context {
|
func (gui *Gui) allContexts() []types.Context {
|
||||||
return []types.Context{
|
return []types.Context{
|
||||||
gui.State.Contexts.Status,
|
gui.State.Contexts.Status,
|
||||||
|
@ -90,7 +38,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
ViewName: "status",
|
ViewName: "status",
|
||||||
Key: STATUS_CONTEXT_KEY,
|
Key: context.STATUS_CONTEXT_KEY,
|
||||||
WindowName: "status",
|
WindowName: "status",
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
|
@ -115,7 +63,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.MAIN_CONTEXT,
|
Kind: types.MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
WindowName: "main",
|
WindowName: "main",
|
||||||
Key: MAIN_NORMAL_CONTEXT_KEY,
|
Key: context.MAIN_NORMAL_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: func(opts ...types.OnFocusOpts) error {
|
OnFocus: func(opts ...types.OnFocusOpts) error {
|
||||||
|
@ -128,7 +76,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.MAIN_CONTEXT,
|
Kind: types.MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
WindowName: "main",
|
WindowName: "main",
|
||||||
Key: MAIN_STAGING_CONTEXT_KEY,
|
Key: context.MAIN_STAGING_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: func(opts ...types.OnFocusOpts) error {
|
OnFocus: func(opts ...types.OnFocusOpts) error {
|
||||||
|
@ -151,7 +99,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.MAIN_CONTEXT,
|
Kind: types.MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
WindowName: "main",
|
WindowName: "main",
|
||||||
Key: MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
Key: context.MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: func(opts ...types.OnFocusOpts) error {
|
OnFocus: func(opts ...types.OnFocusOpts) error {
|
||||||
|
@ -169,7 +117,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.MAIN_CONTEXT,
|
Kind: types.MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
WindowName: "main",
|
WindowName: "main",
|
||||||
Key: MAIN_MERGING_CONTEXT_KEY,
|
Key: context.MAIN_MERGING_CONTEXT_KEY,
|
||||||
OnGetOptionsMap: gui.getMergingOptions,
|
OnGetOptionsMap: gui.getMergingOptions,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
|
@ -181,7 +129,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.PERSISTENT_POPUP,
|
Kind: types.PERSISTENT_POPUP,
|
||||||
ViewName: "credentials",
|
ViewName: "credentials",
|
||||||
WindowName: "credentials",
|
WindowName: "credentials",
|
||||||
Key: CREDENTIALS_CONTEXT_KEY,
|
Key: context.CREDENTIALS_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: OnFocusWrapper(gui.handleAskFocused),
|
OnFocus: OnFocusWrapper(gui.handleAskFocused),
|
||||||
|
@ -192,7 +140,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.TEMPORARY_POPUP,
|
Kind: types.TEMPORARY_POPUP,
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
WindowName: "confirmation",
|
WindowName: "confirmation",
|
||||||
Key: CONFIRMATION_CONTEXT_KEY,
|
Key: context.CONFIRMATION_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: OnFocusWrapper(gui.handleAskFocused),
|
OnFocus: OnFocusWrapper(gui.handleAskFocused),
|
||||||
|
@ -203,7 +151,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.PERSISTENT_POPUP,
|
Kind: types.PERSISTENT_POPUP,
|
||||||
ViewName: "commitMessage",
|
ViewName: "commitMessage",
|
||||||
WindowName: "commitMessage",
|
WindowName: "commitMessage",
|
||||||
Key: COMMIT_MESSAGE_CONTEXT_KEY,
|
Key: context.COMMIT_MESSAGE_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
OnFocus: OnFocusWrapper(gui.handleCommitMessageFocused),
|
OnFocus: OnFocusWrapper(gui.handleCommitMessageFocused),
|
||||||
|
@ -214,7 +162,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.PERSISTENT_POPUP,
|
Kind: types.PERSISTENT_POPUP,
|
||||||
ViewName: "search",
|
ViewName: "search",
|
||||||
WindowName: "search",
|
WindowName: "search",
|
||||||
Key: SEARCH_CONTEXT_KEY,
|
Key: context.SEARCH_CONTEXT_KEY,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{},
|
NewSimpleContextOpts{},
|
||||||
),
|
),
|
||||||
|
@ -223,7 +171,7 @@ func (gui *Gui) contextTree() context.ContextTree {
|
||||||
Kind: types.EXTRAS_CONTEXT,
|
Kind: types.EXTRAS_CONTEXT,
|
||||||
ViewName: "extras",
|
ViewName: "extras",
|
||||||
WindowName: "extras",
|
WindowName: "extras",
|
||||||
Key: COMMAND_LOG_CONTEXT_KEY,
|
Key: context.COMMAND_LOG_CONTEXT_KEY,
|
||||||
OnGetOptionsMap: gui.getMergingOptions,
|
OnGetOptionsMap: gui.getMergingOptions,
|
||||||
}),
|
}),
|
||||||
NewSimpleContextOpts{
|
NewSimpleContextOpts{
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/config"
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
|
@ -314,11 +315,11 @@ func (gui *Gui) GetCustomCommandKeybindings() []*types.Binding {
|
||||||
case "":
|
case "":
|
||||||
log.Fatalf("Error parsing custom command keybindings: context not provided (use context: 'global' for the global context). Key: %s, Command: %s", customCommand.Key, customCommand.Command)
|
log.Fatalf("Error parsing custom command keybindings: context not provided (use context: 'global' for the global context). Key: %s, Command: %s", customCommand.Key, customCommand.Command)
|
||||||
default:
|
default:
|
||||||
context, ok := gui.contextForContextKey(types.ContextKey(customCommand.Context))
|
ctx, ok := gui.contextForContextKey(types.ContextKey(customCommand.Context))
|
||||||
// stupid golang making me build an array of strings for this.
|
// stupid golang making me build an array of strings for this.
|
||||||
allContextKeyStrings := make([]string, len(AllContextKeys))
|
allContextKeyStrings := make([]string, len(context.AllContextKeys))
|
||||||
for i := range AllContextKeys {
|
for i := range context.AllContextKeys {
|
||||||
allContextKeyStrings[i] = string(AllContextKeys[i])
|
allContextKeyStrings[i] = string(context.AllContextKeys[i])
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Fatalf("Error when setting custom command keybindings: unknown context: %s. Key: %s, Command: %s.\nPermitted contexts: %s", customCommand.Context, customCommand.Key, customCommand.Command, strings.Join(allContextKeyStrings, ", "))
|
log.Fatalf("Error when setting custom command keybindings: unknown context: %s. Key: %s, Command: %s.\nPermitted contexts: %s", customCommand.Context, customCommand.Key, customCommand.Command, strings.Join(allContextKeyStrings, ", "))
|
||||||
|
@ -326,7 +327,7 @@ func (gui *Gui) GetCustomCommandKeybindings() []*types.Binding {
|
||||||
// here we assume that a given context will always belong to the same view.
|
// here we assume that a given context will always belong to the same view.
|
||||||
// Currently this is a safe bet but it's by no means guaranteed in the long term
|
// Currently this is a safe bet but it's by no means guaranteed in the long term
|
||||||
// and we might need to make some changes in the future to support it.
|
// and we might need to make some changes in the future to support it.
|
||||||
viewName = context.GetViewName()
|
viewName = ctx.GetViewName()
|
||||||
contexts = []string{customCommand.Context}
|
contexts = []string{customCommand.Context}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,18 @@ package gui
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{
|
var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{
|
||||||
FILES_CONTEXT_KEY,
|
context.FILES_CONTEXT_KEY,
|
||||||
COMMIT_FILES_CONTEXT_KEY,
|
context.COMMIT_FILES_CONTEXT_KEY,
|
||||||
STASH_CONTEXT_KEY,
|
context.STASH_CONTEXT_KEY,
|
||||||
BRANCH_COMMITS_CONTEXT_KEY,
|
context.BRANCH_COMMITS_CONTEXT_KEY,
|
||||||
SUB_COMMITS_CONTEXT_KEY,
|
context.SUB_COMMITS_CONTEXT_KEY,
|
||||||
MAIN_STAGING_CONTEXT_KEY,
|
context.MAIN_STAGING_CONTEXT_KEY,
|
||||||
MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
context.MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
||||||
}
|
}
|
||||||
|
|
||||||
func isShowingDiff(gui *Gui) bool {
|
func isShowingDiff(gui *Gui) bool {
|
||||||
|
@ -59,9 +60,9 @@ func (gui *Gui) handleDiffContextSizeChange() error {
|
||||||
currentContext := gui.currentStaticContext()
|
currentContext := gui.currentStaticContext()
|
||||||
switch currentContext.GetKey() {
|
switch currentContext.GetKey() {
|
||||||
// we make an exception for our staging and patch building contexts because they actually need to refresh their state afterwards.
|
// we make an exception for our staging and patch building contexts because they actually need to refresh their state afterwards.
|
||||||
case MAIN_PATCH_BUILDING_CONTEXT_KEY:
|
case context.MAIN_PATCH_BUILDING_CONTEXT_KEY:
|
||||||
return gui.handleRefreshPatchBuildingPanel(-1)
|
return gui.handleRefreshPatchBuildingPanel(-1)
|
||||||
case MAIN_STAGING_CONTEXT_KEY:
|
case context.MAIN_STAGING_CONTEXT_KEY:
|
||||||
return gui.handleRefreshStagingPanel(false, -1)
|
return gui.handleRefreshStagingPanel(false, -1)
|
||||||
default:
|
default:
|
||||||
return currentContext.HandleRenderToMain()
|
return currentContext.HandleRenderToMain()
|
||||||
|
|
|
@ -6,13 +6,13 @@ package gui
|
||||||
// +++ b/pkg/gui/diff_context_size.go
|
// +++ b/pkg/gui/diff_context_size.go
|
||||||
// @@ -9,12 +9,12 @@ func getRefreshFunction(gui *Gui) func()error {
|
// @@ -9,12 +9,12 @@ func getRefreshFunction(gui *Gui) func()error {
|
||||||
// }
|
// }
|
||||||
// } else if key == MAIN_STAGING_CONTEXT_KEY {
|
// } else if key == context.MAIN_STAGING_CONTEXT_KEY {
|
||||||
// return func() error {
|
// return func() error {
|
||||||
// - selectedLine := gui.Views.Secondary.SelectedLineIdx()
|
// - selectedLine := gui.Views.Secondary.SelectedLineIdx()
|
||||||
// + selectedLine := gui.State.Panels.LineByLine.GetSelectedLineIdx()
|
// + selectedLine := gui.State.Panels.LineByLine.GetSelectedLineIdx()
|
||||||
// return gui.handleRefreshStagingPanel(false, selectedLine)
|
// return gui.handleRefreshStagingPanel(false, selectedLine)
|
||||||
// }
|
// }
|
||||||
// } else if key == MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
// } else if key == context.MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
||||||
// `
|
// `
|
||||||
|
|
||||||
// func setupGuiForTest(gui *Gui) {
|
// func setupGuiForTest(gui *Gui) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
@ -35,12 +36,12 @@ func (gui *Gui) currentDiffTerminals() []string {
|
||||||
switch gui.currentContext().GetKey() {
|
switch gui.currentContext().GetKey() {
|
||||||
case "":
|
case "":
|
||||||
return nil
|
return nil
|
||||||
case FILES_CONTEXT_KEY, SUBMODULES_CONTEXT_KEY:
|
case context.FILES_CONTEXT_KEY, context.SUBMODULES_CONTEXT_KEY:
|
||||||
// TODO: should we just return nil here?
|
// TODO: should we just return nil here?
|
||||||
return []string{""}
|
return []string{""}
|
||||||
case COMMIT_FILES_CONTEXT_KEY:
|
case context.COMMIT_FILES_CONTEXT_KEY:
|
||||||
return []string{gui.State.Panels.CommitFiles.refName}
|
return []string{gui.State.Panels.CommitFiles.refName}
|
||||||
case LOCAL_BRANCHES_CONTEXT_KEY:
|
case context.LOCAL_BRANCHES_CONTEXT_KEY:
|
||||||
// for our local branches we want to include both the branch and its upstream
|
// for our local branches we want to include both the branch and its upstream
|
||||||
branch := gui.getSelectedBranch()
|
branch := gui.getSelectedBranch()
|
||||||
if branch != nil {
|
if branch != nil {
|
||||||
|
@ -74,7 +75,7 @@ func (gui *Gui) currentDiffTerminal() string {
|
||||||
|
|
||||||
func (gui *Gui) currentlySelectedFilename() string {
|
func (gui *Gui) currentlySelectedFilename() string {
|
||||||
switch gui.currentContext().GetKey() {
|
switch gui.currentContext().GetKey() {
|
||||||
case FILES_CONTEXT_KEY, COMMIT_FILES_CONTEXT_KEY:
|
case context.FILES_CONTEXT_KEY, context.COMMIT_FILES_CONTEXT_KEY:
|
||||||
return gui.getSideContextSelectedItemId()
|
return gui.getSideContextSelectedItemId()
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -3,6 +3,7 @@ package gui
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
@ -15,7 +16,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
|
||||||
DisplayString: gui.c.Tr.ToggleShowCommandLog,
|
DisplayString: gui.c.Tr.ToggleShowCommandLog,
|
||||||
OnPress: func() error {
|
OnPress: func() error {
|
||||||
currentContext := gui.currentStaticContext()
|
currentContext := gui.currentStaticContext()
|
||||||
if gui.ShowExtrasWindow && currentContext.GetKey() == COMMAND_LOG_CONTEXT_KEY {
|
if gui.ShowExtrasWindow && currentContext.GetKey() == context.COMMAND_LOG_CONTEXT_KEY {
|
||||||
if err := gui.returnFromContext(); err != nil {
|
if err := gui.returnFromContext(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
|
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
@ -113,14 +114,14 @@ func (gui *Gui) refreshFilesAndSubmodules() error {
|
||||||
gui.c.Log.Error(err)
|
gui.c.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if types.ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY {
|
if types.ContextKey(gui.Views.Files.Context) == context.FILES_CONTEXT_KEY {
|
||||||
// doing this a little custom (as opposed to using gui.c.PostRefreshUpdate) because we handle selecting the file explicitly below
|
// doing this a little custom (as opposed to using gui.c.PostRefreshUpdate) because we handle selecting the file explicitly below
|
||||||
if err := gui.State.Contexts.Files.HandleRender(); err != nil {
|
if err := gui.State.Contexts.Files.HandleRender(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.currentContext().GetKey() == FILES_CONTEXT_KEY {
|
if gui.currentContext().GetKey() == context.FILES_CONTEXT_KEY {
|
||||||
currentSelectedPath := gui.getSelectedPath()
|
currentSelectedPath := gui.getSelectedPath()
|
||||||
alreadySelected := prevSelectedPath != "" && currentSelectedPath == prevSelectedPath
|
alreadySelected := prevSelectedPath != "" && currentSelectedPath == prevSelectedPath
|
||||||
if !alreadySelected {
|
if !alreadySelected {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/constants"
|
"github.com/jesseduffield/lazygit/pkg/constants"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -355,7 +356,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Remove),
|
Key: gui.getKey(config.Universal.Remove),
|
||||||
Handler: gui.handleCreateDiscardMenu,
|
Handler: gui.handleCreateDiscardMenu,
|
||||||
Description: gui.c.Tr.LcViewDiscardOptions,
|
Description: gui.c.Tr.LcViewDiscardOptions,
|
||||||
|
@ -363,7 +364,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.ViewResetOptions),
|
Key: gui.getKey(config.Files.ViewResetOptions),
|
||||||
Handler: gui.handleCreateResetMenu,
|
Handler: gui.handleCreateResetMenu,
|
||||||
Description: gui.c.Tr.LcViewResetOptions,
|
Description: gui.c.Tr.LcViewResetOptions,
|
||||||
|
@ -371,35 +372,35 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.Fetch),
|
Key: gui.getKey(config.Files.Fetch),
|
||||||
Handler: gui.handleGitFetch,
|
Handler: gui.handleGitFetch,
|
||||||
Description: gui.c.Tr.LcFetch,
|
Description: gui.c.Tr.LcFetch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopyFileNameToClipboard,
|
Description: gui.c.Tr.LcCopyFileNameToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.handleBranchPress,
|
Handler: gui.handleBranchPress,
|
||||||
Description: gui.c.Tr.LcCheckout,
|
Description: gui.c.Tr.LcCheckout,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.CreatePullRequest),
|
Key: gui.getKey(config.Branches.CreatePullRequest),
|
||||||
Handler: gui.handleCreatePullRequestPress,
|
Handler: gui.handleCreatePullRequestPress,
|
||||||
Description: gui.c.Tr.LcCreatePullRequest,
|
Description: gui.c.Tr.LcCreatePullRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.ViewPullRequestOptions),
|
Key: gui.getKey(config.Branches.ViewPullRequestOptions),
|
||||||
Handler: gui.handleCreatePullRequestMenu,
|
Handler: gui.handleCreatePullRequestMenu,
|
||||||
Description: gui.c.Tr.LcCreatePullRequestOptions,
|
Description: gui.c.Tr.LcCreatePullRequestOptions,
|
||||||
|
@ -407,56 +408,56 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.CopyPullRequestURL),
|
Key: gui.getKey(config.Branches.CopyPullRequestURL),
|
||||||
Handler: gui.handleCopyPullRequestURLPress,
|
Handler: gui.handleCopyPullRequestURLPress,
|
||||||
Description: gui.c.Tr.LcCopyPullRequestURL,
|
Description: gui.c.Tr.LcCopyPullRequestURL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.CheckoutBranchByName),
|
Key: gui.getKey(config.Branches.CheckoutBranchByName),
|
||||||
Handler: gui.handleCheckoutByName,
|
Handler: gui.handleCheckoutByName,
|
||||||
Description: gui.c.Tr.LcCheckoutByName,
|
Description: gui.c.Tr.LcCheckoutByName,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.ForceCheckoutBranch),
|
Key: gui.getKey(config.Branches.ForceCheckoutBranch),
|
||||||
Handler: gui.handleForceCheckout,
|
Handler: gui.handleForceCheckout,
|
||||||
Description: gui.c.Tr.LcForceCheckout,
|
Description: gui.c.Tr.LcForceCheckout,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.New),
|
Key: gui.getKey(config.Universal.New),
|
||||||
Handler: gui.handleNewBranchOffCurrentItem,
|
Handler: gui.handleNewBranchOffCurrentItem,
|
||||||
Description: gui.c.Tr.LcNewBranch,
|
Description: gui.c.Tr.LcNewBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Remove),
|
Key: gui.getKey(config.Universal.Remove),
|
||||||
Handler: gui.handleDeleteBranch,
|
Handler: gui.handleDeleteBranch,
|
||||||
Description: gui.c.Tr.LcDeleteBranch,
|
Description: gui.c.Tr.LcDeleteBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.RebaseBranch),
|
Key: gui.getKey(config.Branches.RebaseBranch),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleRebaseOntoLocalBranch),
|
Handler: guards.OutsideFilterMode(gui.handleRebaseOntoLocalBranch),
|
||||||
Description: gui.c.Tr.LcRebaseBranch,
|
Description: gui.c.Tr.LcRebaseBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.MergeIntoCurrentBranch),
|
Key: gui.getKey(config.Branches.MergeIntoCurrentBranch),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleMerge),
|
Handler: guards.OutsideFilterMode(gui.handleMerge),
|
||||||
Description: gui.c.Tr.LcMergeIntoCurrentBranch,
|
Description: gui.c.Tr.LcMergeIntoCurrentBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.ViewGitFlowOptions),
|
Key: gui.getKey(config.Branches.ViewGitFlowOptions),
|
||||||
Handler: gui.handleCreateGitFlowMenu,
|
Handler: gui.handleCreateGitFlowMenu,
|
||||||
Description: gui.c.Tr.LcGitFlowOptions,
|
Description: gui.c.Tr.LcGitFlowOptions,
|
||||||
|
@ -464,14 +465,14 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.FastForward),
|
Key: gui.getKey(config.Branches.FastForward),
|
||||||
Handler: gui.handleFastForward,
|
Handler: gui.handleFastForward,
|
||||||
Description: gui.c.Tr.FastForward,
|
Description: gui.c.Tr.FastForward,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ViewResetOptions),
|
Key: gui.getKey(config.Commits.ViewResetOptions),
|
||||||
Handler: gui.handleCreateResetToBranchMenu,
|
Handler: gui.handleCreateResetToBranchMenu,
|
||||||
Description: gui.c.Tr.LcViewResetOptions,
|
Description: gui.c.Tr.LcViewResetOptions,
|
||||||
|
@ -479,35 +480,35 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.RenameBranch),
|
Key: gui.getKey(config.Branches.RenameBranch),
|
||||||
Handler: gui.handleRenameBranch,
|
Handler: gui.handleRenameBranch,
|
||||||
Description: gui.c.Tr.LcRenameBranch,
|
Description: gui.c.Tr.LcRenameBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopyBranchNameToClipboard,
|
Description: gui.c.Tr.LcCopyBranchNameToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GoInto),
|
Key: gui.getKey(config.Universal.GoInto),
|
||||||
Handler: gui.handleSwitchToSubCommits,
|
Handler: gui.handleSwitchToSubCommits,
|
||||||
Description: gui.c.Tr.LcViewCommits,
|
Description: gui.c.Tr.LcViewCommits,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Return),
|
Key: gui.getKey(config.Universal.Return),
|
||||||
Handler: gui.handleRemoteBranchesEscape,
|
Handler: gui.handleRemoteBranchesEscape,
|
||||||
Description: gui.c.Tr.ReturnToRemotesList,
|
Description: gui.c.Tr.ReturnToRemotesList,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ViewResetOptions),
|
Key: gui.getKey(config.Commits.ViewResetOptions),
|
||||||
Handler: gui.handleCreateResetToRemoteBranchMenu,
|
Handler: gui.handleCreateResetToRemoteBranchMenu,
|
||||||
Description: gui.c.Tr.LcViewResetOptions,
|
Description: gui.c.Tr.LcViewResetOptions,
|
||||||
|
@ -515,42 +516,42 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GoInto),
|
Key: gui.getKey(config.Universal.GoInto),
|
||||||
Handler: gui.handleSwitchToSubCommits,
|
Handler: gui.handleSwitchToSubCommits,
|
||||||
Description: gui.c.Tr.LcViewCommits,
|
Description: gui.c.Tr.LcViewCommits,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopy),
|
Key: gui.getKey(config.Commits.CherryPickCopy),
|
||||||
Handler: gui.handleCopyCommit,
|
Handler: gui.handleCopyCommit,
|
||||||
Description: gui.c.Tr.LcCherryPickCopy,
|
Description: gui.c.Tr.LcCherryPickCopy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
||||||
Handler: gui.handleCopyCommitRange,
|
Handler: gui.handleCopyCommitRange,
|
||||||
Description: gui.c.Tr.LcCherryPickCopyRange,
|
Description: gui.c.Tr.LcCherryPickCopyRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.PasteCommits),
|
Key: gui.getKey(config.Commits.PasteCommits),
|
||||||
Handler: guards.OutsideFilterMode(gui.HandlePasteCommits),
|
Handler: guards.OutsideFilterMode(gui.HandlePasteCommits),
|
||||||
Description: gui.c.Tr.LcPasteCommits,
|
Description: gui.c.Tr.LcPasteCommits,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.New),
|
Key: gui.getKey(config.Universal.New),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleNewBranchOffCurrentItem,
|
Handler: gui.handleNewBranchOffCurrentItem,
|
||||||
|
@ -558,28 +559,28 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(BRANCH_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ResetCherryPick),
|
Key: gui.getKey(config.Commits.ResetCherryPick),
|
||||||
Handler: gui.exitCherryPickingMode,
|
Handler: gui.exitCherryPickingMode,
|
||||||
Description: gui.c.Tr.LcResetCherryPick,
|
Description: gui.c.Tr.LcResetCherryPick,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GoInto),
|
Key: gui.getKey(config.Universal.GoInto),
|
||||||
Handler: gui.handleViewReflogCommitFiles,
|
Handler: gui.handleViewReflogCommitFiles,
|
||||||
Description: gui.c.Tr.LcViewCommitFiles,
|
Description: gui.c.Tr.LcViewCommitFiles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.CheckoutReflogCommit,
|
Handler: gui.CheckoutReflogCommit,
|
||||||
Description: gui.c.Tr.LcCheckoutCommit,
|
Description: gui.c.Tr.LcCheckoutCommit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ViewResetOptions),
|
Key: gui.getKey(config.Commits.ViewResetOptions),
|
||||||
Handler: gui.handleCreateReflogResetMenu,
|
Handler: gui.handleCreateReflogResetMenu,
|
||||||
Description: gui.c.Tr.LcViewResetOptions,
|
Description: gui.c.Tr.LcViewResetOptions,
|
||||||
|
@ -587,49 +588,49 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopy),
|
Key: gui.getKey(config.Commits.CherryPickCopy),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleCopyCommit),
|
Handler: guards.OutsideFilterMode(gui.handleCopyCommit),
|
||||||
Description: gui.c.Tr.LcCherryPickCopy,
|
Description: gui.c.Tr.LcCherryPickCopy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleCopyCommitRange),
|
Handler: guards.OutsideFilterMode(gui.handleCopyCommitRange),
|
||||||
Description: gui.c.Tr.LcCherryPickCopyRange,
|
Description: gui.c.Tr.LcCherryPickCopyRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ResetCherryPick),
|
Key: gui.getKey(config.Commits.ResetCherryPick),
|
||||||
Handler: gui.exitCherryPickingMode,
|
Handler: gui.exitCherryPickingMode,
|
||||||
Description: gui.c.Tr.LcResetCherryPick,
|
Description: gui.c.Tr.LcResetCherryPick,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{string(REFLOG_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GoInto),
|
Key: gui.getKey(config.Universal.GoInto),
|
||||||
Handler: gui.handleViewSubCommitFiles,
|
Handler: gui.handleViewSubCommitFiles,
|
||||||
Description: gui.c.Tr.LcViewCommitFiles,
|
Description: gui.c.Tr.LcViewCommitFiles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.handleCheckoutSubCommit,
|
Handler: gui.handleCheckoutSubCommit,
|
||||||
Description: gui.c.Tr.LcCheckoutCommit,
|
Description: gui.c.Tr.LcCheckoutCommit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ViewResetOptions),
|
Key: gui.getKey(config.Commits.ViewResetOptions),
|
||||||
Handler: gui.handleCreateSubCommitResetMenu,
|
Handler: gui.handleCreateSubCommitResetMenu,
|
||||||
Description: gui.c.Tr.LcViewResetOptions,
|
Description: gui.c.Tr.LcViewResetOptions,
|
||||||
|
@ -637,35 +638,35 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.New),
|
Key: gui.getKey(config.Universal.New),
|
||||||
Handler: gui.handleNewBranchOffCurrentItem,
|
Handler: gui.handleNewBranchOffCurrentItem,
|
||||||
Description: gui.c.Tr.LcNewBranch,
|
Description: gui.c.Tr.LcNewBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopy),
|
Key: gui.getKey(config.Commits.CherryPickCopy),
|
||||||
Handler: gui.handleCopyCommit,
|
Handler: gui.handleCopyCommit,
|
||||||
Description: gui.c.Tr.LcCherryPickCopy,
|
Description: gui.c.Tr.LcCherryPickCopy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
Key: gui.getKey(config.Commits.CherryPickCopyRange),
|
||||||
Handler: gui.handleCopyCommitRange,
|
Handler: gui.handleCopyCommitRange,
|
||||||
Description: gui.c.Tr.LcCherryPickCopyRange,
|
Description: gui.c.Tr.LcCherryPickCopyRange,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Commits.ResetCherryPick),
|
Key: gui.getKey(config.Commits.ResetCherryPick),
|
||||||
Handler: gui.exitCherryPickingMode,
|
Handler: gui.exitCherryPickingMode,
|
||||||
Description: gui.c.Tr.LcResetCherryPick,
|
Description: gui.c.Tr.LcResetCherryPick,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(SUB_COMMITS_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
Description: gui.c.Tr.LcCopyCommitShaToClipboard,
|
||||||
|
@ -826,14 +827,14 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "secondary",
|
ViewName: "secondary",
|
||||||
Contexts: []string{string(MAIN_NORMAL_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleMouseDownSecondary,
|
Handler: gui.handleMouseDownSecondary,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_NORMAL_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelDown,
|
Key: gocui.MouseWheelDown,
|
||||||
Handler: gui.scrollDownMain,
|
Handler: gui.scrollDownMain,
|
||||||
Description: gui.c.Tr.ScrollDown,
|
Description: gui.c.Tr.ScrollDown,
|
||||||
|
@ -841,7 +842,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_NORMAL_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelUp,
|
Key: gocui.MouseWheelUp,
|
||||||
Handler: gui.scrollUpMain,
|
Handler: gui.scrollUpMain,
|
||||||
Description: gui.c.Tr.ScrollUp,
|
Description: gui.c.Tr.ScrollUp,
|
||||||
|
@ -849,133 +850,133 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_NORMAL_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleMouseDownMain,
|
Handler: gui.handleMouseDownMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "secondary",
|
ViewName: "secondary",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleTogglePanelClick,
|
Handler: gui.handleTogglePanelClick,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Return),
|
Key: gui.getKey(config.Universal.Return),
|
||||||
Handler: gui.handleStagingEscape,
|
Handler: gui.handleStagingEscape,
|
||||||
Description: gui.c.Tr.ReturnToFilesPanel,
|
Description: gui.c.Tr.ReturnToFilesPanel,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.handleToggleStagedSelection,
|
Handler: gui.handleToggleStagedSelection,
|
||||||
Description: gui.c.Tr.StageSelection,
|
Description: gui.c.Tr.StageSelection,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Remove),
|
Key: gui.getKey(config.Universal.Remove),
|
||||||
Handler: gui.handleResetSelection,
|
Handler: gui.handleResetSelection,
|
||||||
Description: gui.c.Tr.ResetSelection,
|
Description: gui.c.Tr.ResetSelection,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.TogglePanel),
|
Key: gui.getKey(config.Universal.TogglePanel),
|
||||||
Handler: gui.handleTogglePanel,
|
Handler: gui.handleTogglePanel,
|
||||||
Description: gui.c.Tr.TogglePanel,
|
Description: gui.c.Tr.TogglePanel,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Return),
|
Key: gui.getKey(config.Universal.Return),
|
||||||
Handler: gui.handleEscapePatchBuildingPanel,
|
Handler: gui.handleEscapePatchBuildingPanel,
|
||||||
Description: gui.c.Tr.ExitLineByLineMode,
|
Description: gui.c.Tr.ExitLineByLineMode,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.OpenFile),
|
Key: gui.getKey(config.Universal.OpenFile),
|
||||||
Handler: gui.handleOpenFileAtLine,
|
Handler: gui.handleOpenFileAtLine,
|
||||||
Description: gui.c.Tr.LcOpenFile,
|
Description: gui.c.Tr.LcOpenFile,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItem),
|
Key: gui.getKey(config.Universal.PrevItem),
|
||||||
Handler: gui.handleSelectPrevLine,
|
Handler: gui.handleSelectPrevLine,
|
||||||
Description: gui.c.Tr.PrevLine,
|
Description: gui.c.Tr.PrevLine,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItem),
|
Key: gui.getKey(config.Universal.NextItem),
|
||||||
Handler: gui.handleSelectNextLine,
|
Handler: gui.handleSelectNextLine,
|
||||||
Description: gui.c.Tr.NextLine,
|
Description: gui.c.Tr.NextLine,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItemAlt),
|
Key: gui.getKey(config.Universal.PrevItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectPrevLine,
|
Handler: gui.handleSelectPrevLine,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItemAlt),
|
Key: gui.getKey(config.Universal.NextItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectNextLine,
|
Handler: gui.handleSelectNextLine,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelUp,
|
Key: gocui.MouseWheelUp,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollUpMain,
|
Handler: gui.scrollUpMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelDown,
|
Key: gocui.MouseWheelDown,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollDownMain,
|
Handler: gui.scrollDownMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevBlock),
|
Key: gui.getKey(config.Universal.PrevBlock),
|
||||||
Handler: gui.handleSelectPrevHunk,
|
Handler: gui.handleSelectPrevHunk,
|
||||||
Description: gui.c.Tr.PrevHunk,
|
Description: gui.c.Tr.PrevHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevBlockAlt),
|
Key: gui.getKey(config.Universal.PrevBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectPrevHunk,
|
Handler: gui.handleSelectPrevHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextBlock),
|
Key: gui.getKey(config.Universal.NextBlock),
|
||||||
Handler: gui.handleSelectNextHunk,
|
Handler: gui.handleSelectNextHunk,
|
||||||
Description: gui.c.Tr.NextHunk,
|
Description: gui.c.Tr.NextHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextBlockAlt),
|
Key: gui.getKey(config.Universal.NextBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectNextHunk,
|
Handler: gui.handleSelectNextHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.copySelectedToClipboard,
|
Handler: gui.copySelectedToClipboard,
|
||||||
|
@ -983,21 +984,21 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Edit),
|
Key: gui.getKey(config.Universal.Edit),
|
||||||
Handler: gui.handleLineByLineEdit,
|
Handler: gui.handleLineByLineEdit,
|
||||||
Description: gui.c.Tr.LcEditFile,
|
Description: gui.c.Tr.LcEditFile,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.OpenFile),
|
Key: gui.getKey(config.Universal.OpenFile),
|
||||||
Handler: gui.Controllers.Files.Open,
|
Handler: gui.Controllers.Files.Open,
|
||||||
Description: gui.c.Tr.LcOpenFile,
|
Description: gui.c.Tr.LcOpenFile,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextPage),
|
Key: gui.getKey(config.Universal.NextPage),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleLineByLineNextPage,
|
Handler: gui.handleLineByLineNextPage,
|
||||||
|
@ -1006,7 +1007,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevPage),
|
Key: gui.getKey(config.Universal.PrevPage),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleLineByLinePrevPage,
|
Handler: gui.handleLineByLinePrevPage,
|
||||||
|
@ -1015,7 +1016,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GotoTop),
|
Key: gui.getKey(config.Universal.GotoTop),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleLineByLineGotoTop,
|
Handler: gui.handleLineByLineGotoTop,
|
||||||
|
@ -1024,7 +1025,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.GotoBottom),
|
Key: gui.getKey(config.Universal.GotoBottom),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleLineByLineGotoBottom,
|
Handler: gui.handleLineByLineGotoBottom,
|
||||||
|
@ -1033,7 +1034,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.StartSearch),
|
Key: gui.getKey(config.Universal.StartSearch),
|
||||||
Handler: func() error { return gui.handleOpenSearch("main") },
|
Handler: func() error { return gui.handleOpenSearch("main") },
|
||||||
Description: gui.c.Tr.LcStartSearch,
|
Description: gui.c.Tr.LcStartSearch,
|
||||||
|
@ -1041,14 +1042,14 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.handleToggleSelectionForPatch,
|
Handler: gui.handleToggleSelectionForPatch,
|
||||||
Description: gui.c.Tr.ToggleSelectionForPatch,
|
Description: gui.c.Tr.ToggleSelectionForPatch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Main.ToggleDragSelect),
|
Key: gui.getKey(config.Main.ToggleDragSelect),
|
||||||
Handler: gui.handleToggleSelectRange,
|
Handler: gui.handleToggleSelectRange,
|
||||||
Description: gui.c.Tr.ToggleDragSelect,
|
Description: gui.c.Tr.ToggleDragSelect,
|
||||||
|
@ -1056,175 +1057,175 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
// Alias 'V' -> 'v'
|
// Alias 'V' -> 'v'
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Main.ToggleDragSelectAlt),
|
Key: gui.getKey(config.Main.ToggleDragSelectAlt),
|
||||||
Handler: gui.handleToggleSelectRange,
|
Handler: gui.handleToggleSelectRange,
|
||||||
Description: gui.c.Tr.ToggleDragSelect,
|
Description: gui.c.Tr.ToggleDragSelect,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Main.ToggleSelectHunk),
|
Key: gui.getKey(config.Main.ToggleSelectHunk),
|
||||||
Handler: gui.handleToggleSelectHunk,
|
Handler: gui.handleToggleSelectHunk,
|
||||||
Description: gui.c.Tr.ToggleSelectHunk,
|
Description: gui.c.Tr.ToggleSelectHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleLBLMouseDown,
|
Handler: gui.handleLBLMouseDown,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Modifier: gocui.ModMotion,
|
Modifier: gocui.ModMotion,
|
||||||
Handler: gui.handleMouseDrag,
|
Handler: gui.handleMouseDrag,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelUp,
|
Key: gocui.MouseWheelUp,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollUpMain,
|
Handler: gui.scrollUpMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gocui.MouseWheelDown,
|
Key: gocui.MouseWheelDown,
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollDownMain,
|
Handler: gui.scrollDownMain,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY), string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY), string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.ScrollLeft),
|
Key: gui.getKey(config.Universal.ScrollLeft),
|
||||||
Handler: gui.scrollLeftMain,
|
Handler: gui.scrollLeftMain,
|
||||||
Description: gui.c.Tr.LcScrollLeft,
|
Description: gui.c.Tr.LcScrollLeft,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY), string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY), string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.ScrollRight),
|
Key: gui.getKey(config.Universal.ScrollRight),
|
||||||
Handler: gui.scrollRightMain,
|
Handler: gui.scrollRightMain,
|
||||||
Description: gui.c.Tr.LcScrollRight,
|
Description: gui.c.Tr.LcScrollRight,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.CommitChanges),
|
Key: gui.getKey(config.Files.CommitChanges),
|
||||||
Handler: gui.Controllers.Files.HandleCommitPress,
|
Handler: gui.Controllers.Files.HandleCommitPress,
|
||||||
Description: gui.c.Tr.CommitChanges,
|
Description: gui.c.Tr.CommitChanges,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.CommitChangesWithoutHook),
|
Key: gui.getKey(config.Files.CommitChangesWithoutHook),
|
||||||
Handler: gui.Controllers.Files.HandleWIPCommitPress,
|
Handler: gui.Controllers.Files.HandleWIPCommitPress,
|
||||||
Description: gui.c.Tr.LcCommitChangesWithoutHook,
|
Description: gui.c.Tr.LcCommitChangesWithoutHook,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.CommitChangesWithEditor),
|
Key: gui.getKey(config.Files.CommitChangesWithEditor),
|
||||||
Handler: gui.Controllers.Files.HandleCommitEditorPress,
|
Handler: gui.Controllers.Files.HandleCommitEditorPress,
|
||||||
Description: gui.c.Tr.CommitChangesWithEditor,
|
Description: gui.c.Tr.CommitChangesWithEditor,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Return),
|
Key: gui.getKey(config.Universal.Return),
|
||||||
Handler: gui.handleEscapeMerge,
|
Handler: gui.handleEscapeMerge,
|
||||||
Description: gui.c.Tr.ReturnToFilesPanel,
|
Description: gui.c.Tr.ReturnToFilesPanel,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Files.OpenMergeTool),
|
Key: gui.getKey(config.Files.OpenMergeTool),
|
||||||
Handler: gui.Controllers.Files.OpenMergeTool,
|
Handler: gui.Controllers.Files.OpenMergeTool,
|
||||||
Description: gui.c.Tr.LcOpenMergeTool,
|
Description: gui.c.Tr.LcOpenMergeTool,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
Handler: gui.handlePickHunk,
|
Handler: gui.handlePickHunk,
|
||||||
Description: gui.c.Tr.PickHunk,
|
Description: gui.c.Tr.PickHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Main.PickBothHunks),
|
Key: gui.getKey(config.Main.PickBothHunks),
|
||||||
Handler: gui.handlePickAllHunks,
|
Handler: gui.handlePickAllHunks,
|
||||||
Description: gui.c.Tr.PickAllHunks,
|
Description: gui.c.Tr.PickAllHunks,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevBlock),
|
Key: gui.getKey(config.Universal.PrevBlock),
|
||||||
Handler: gui.handleSelectPrevConflict,
|
Handler: gui.handleSelectPrevConflict,
|
||||||
Description: gui.c.Tr.PrevConflict,
|
Description: gui.c.Tr.PrevConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextBlock),
|
Key: gui.getKey(config.Universal.NextBlock),
|
||||||
Handler: gui.handleSelectNextConflict,
|
Handler: gui.handleSelectNextConflict,
|
||||||
Description: gui.c.Tr.NextConflict,
|
Description: gui.c.Tr.NextConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItem),
|
Key: gui.getKey(config.Universal.PrevItem),
|
||||||
Handler: gui.handleSelectPrevConflictHunk,
|
Handler: gui.handleSelectPrevConflictHunk,
|
||||||
Description: gui.c.Tr.SelectPrevHunk,
|
Description: gui.c.Tr.SelectPrevHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItem),
|
Key: gui.getKey(config.Universal.NextItem),
|
||||||
Handler: gui.handleSelectNextConflictHunk,
|
Handler: gui.handleSelectNextConflictHunk,
|
||||||
Description: gui.c.Tr.SelectNextHunk,
|
Description: gui.c.Tr.SelectNextHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevBlockAlt),
|
Key: gui.getKey(config.Universal.PrevBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectPrevConflict,
|
Handler: gui.handleSelectPrevConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextBlockAlt),
|
Key: gui.getKey(config.Universal.NextBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectNextConflict,
|
Handler: gui.handleSelectNextConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItemAlt),
|
Key: gui.getKey(config.Universal.PrevItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectPrevConflictHunk,
|
Handler: gui.handleSelectPrevConflictHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItemAlt),
|
Key: gui.getKey(config.Universal.NextItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleSelectNextConflictHunk,
|
Handler: gui.handleSelectNextConflictHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Undo),
|
Key: gui.getKey(config.Universal.Undo),
|
||||||
Handler: gui.handleMergeConflictUndo,
|
Handler: gui.handleMergeConflictUndo,
|
||||||
Description: gui.c.Tr.LcUndo,
|
Description: gui.c.Tr.LcUndo,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Select),
|
Key: gui.getKey(config.Universal.Select),
|
||||||
// gonna use the exact same handler as the 'n' keybinding because everybody wants this to happen when they checkout a remote branch
|
// gonna use the exact same handler as the 'n' keybinding because everybody wants this to happen when they checkout a remote branch
|
||||||
Handler: gui.handleNewBranchOffCurrentItem,
|
Handler: gui.handleNewBranchOffCurrentItem,
|
||||||
|
@ -1232,35 +1233,35 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.New),
|
Key: gui.getKey(config.Universal.New),
|
||||||
Handler: gui.handleNewBranchOffCurrentItem,
|
Handler: gui.handleNewBranchOffCurrentItem,
|
||||||
Description: gui.c.Tr.LcNewBranch,
|
Description: gui.c.Tr.LcNewBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.MergeIntoCurrentBranch),
|
Key: gui.getKey(config.Branches.MergeIntoCurrentBranch),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleMergeRemoteBranch),
|
Handler: guards.OutsideFilterMode(gui.handleMergeRemoteBranch),
|
||||||
Description: gui.c.Tr.LcMergeIntoCurrentBranch,
|
Description: gui.c.Tr.LcMergeIntoCurrentBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.Remove),
|
Key: gui.getKey(config.Universal.Remove),
|
||||||
Handler: gui.handleDeleteRemoteBranch,
|
Handler: gui.handleDeleteRemoteBranch,
|
||||||
Description: gui.c.Tr.LcDeleteBranch,
|
Description: gui.c.Tr.LcDeleteBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.RebaseBranch),
|
Key: gui.getKey(config.Branches.RebaseBranch),
|
||||||
Handler: guards.OutsideFilterMode(gui.handleRebaseOntoRemoteBranch),
|
Handler: guards.OutsideFilterMode(gui.handleRebaseOntoRemoteBranch),
|
||||||
Description: gui.c.Tr.LcRebaseBranch,
|
Description: gui.c.Tr.LcRebaseBranch,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
Contexts: []string{string(REMOTE_BRANCHES_CONTEXT_KEY)},
|
Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Branches.SetUpstream),
|
Key: gui.getKey(config.Branches.SetUpstream),
|
||||||
Handler: gui.handleSetBranchUpstream,
|
Handler: gui.handleSetBranchUpstream,
|
||||||
Description: gui.c.Tr.LcSetUpstream,
|
Description: gui.c.Tr.LcSetUpstream,
|
||||||
|
@ -1309,14 +1310,14 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(SUBMODULES_CONTEXT_KEY)},
|
Contexts: []string{string(context.SUBMODULES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.CopyToClipboard),
|
Key: gui.getKey(config.Universal.CopyToClipboard),
|
||||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||||
Description: gui.c.Tr.LcCopySubmoduleNameToClipboard,
|
Description: gui.c.Tr.LcCopySubmoduleNameToClipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.ToggleWhitespaceInDiffView),
|
Key: gui.getKey(config.Universal.ToggleWhitespaceInDiffView),
|
||||||
Handler: gui.toggleWhitespaceInDiffView,
|
Handler: gui.toggleWhitespaceInDiffView,
|
||||||
Description: gui.c.Tr.ToggleWhitespaceInDiffView,
|
Description: gui.c.Tr.ToggleWhitespaceInDiffView,
|
||||||
|
@ -1353,7 +1354,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
{
|
{
|
||||||
ViewName: "extras",
|
ViewName: "extras",
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
Contexts: []string{string(COMMAND_LOG_CONTEXT_KEY)},
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItemAlt),
|
Key: gui.getKey(config.Universal.PrevItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollUpExtra,
|
Handler: gui.scrollUpExtra,
|
||||||
|
@ -1361,7 +1362,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
{
|
{
|
||||||
ViewName: "extras",
|
ViewName: "extras",
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
Contexts: []string{string(COMMAND_LOG_CONTEXT_KEY)},
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.PrevItem),
|
Key: gui.getKey(config.Universal.PrevItem),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollUpExtra,
|
Handler: gui.scrollUpExtra,
|
||||||
|
@ -1369,7 +1370,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
{
|
{
|
||||||
ViewName: "extras",
|
ViewName: "extras",
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
Contexts: []string{string(COMMAND_LOG_CONTEXT_KEY)},
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItem),
|
Key: gui.getKey(config.Universal.NextItem),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollDownExtra,
|
Handler: gui.scrollDownExtra,
|
||||||
|
@ -1377,7 +1378,7 @@ func (gui *Gui) GetInitialKeybindings() []*types.Binding {
|
||||||
{
|
{
|
||||||
ViewName: "extras",
|
ViewName: "extras",
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
Contexts: []string{string(COMMAND_LOG_CONTEXT_KEY)},
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
||||||
Key: gui.getKey(config.Universal.NextItemAlt),
|
Key: gui.getKey(config.Universal.NextItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.scrollDownExtra,
|
Handler: gui.scrollDownExtra,
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (gui *Gui) filesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
WindowName: "files",
|
WindowName: "files",
|
||||||
Key: FILES_CONTEXT_KEY,
|
Key: context.FILES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return gui.State.FileTreeViewModel.GetItemsLength() },
|
GetItemsLength: func() int { return gui.State.FileTreeViewModel.GetItemsLength() },
|
||||||
|
@ -62,7 +62,7 @@ func (gui *Gui) branchesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
WindowName: "branches",
|
WindowName: "branches",
|
||||||
Key: LOCAL_BRANCHES_CONTEXT_KEY,
|
Key: context.LOCAL_BRANCHES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.Branches) },
|
GetItemsLength: func() int { return len(gui.State.Branches) },
|
||||||
|
@ -84,7 +84,7 @@ func (gui *Gui) remotesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
WindowName: "branches",
|
WindowName: "branches",
|
||||||
Key: REMOTES_CONTEXT_KEY,
|
Key: context.REMOTES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.Remotes) },
|
GetItemsLength: func() int { return len(gui.State.Remotes) },
|
||||||
|
@ -106,7 +106,7 @@ func (gui *Gui) remoteBranchesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
WindowName: "branches",
|
WindowName: "branches",
|
||||||
Key: REMOTE_BRANCHES_CONTEXT_KEY,
|
Key: context.REMOTE_BRANCHES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.RemoteBranches) },
|
GetItemsLength: func() int { return len(gui.State.RemoteBranches) },
|
||||||
|
@ -153,7 +153,7 @@ func (gui *Gui) branchCommitsListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
WindowName: "commits",
|
WindowName: "commits",
|
||||||
Key: BRANCH_COMMITS_CONTEXT_KEY,
|
Key: context.BRANCH_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.Commits) },
|
GetItemsLength: func() int { return len(gui.State.Commits) },
|
||||||
|
@ -163,7 +163,7 @@ func (gui *Gui) branchCommitsListContext() types.IListContext {
|
||||||
Gui: gui,
|
Gui: gui,
|
||||||
GetDisplayStrings: func(startIdx int, length int) [][]string {
|
GetDisplayStrings: func(startIdx int, length int) [][]string {
|
||||||
selectedCommitSha := ""
|
selectedCommitSha := ""
|
||||||
if gui.currentContext().GetKey() == BRANCH_COMMITS_CONTEXT_KEY {
|
if gui.currentContext().GetKey() == context.BRANCH_COMMITS_CONTEXT_KEY {
|
||||||
selectedCommit := gui.getSelectedLocalCommit()
|
selectedCommit := gui.getSelectedLocalCommit()
|
||||||
if selectedCommit != nil {
|
if selectedCommit != nil {
|
||||||
selectedCommitSha = selectedCommit.Sha
|
selectedCommitSha = selectedCommit.Sha
|
||||||
|
@ -196,7 +196,7 @@ func (gui *Gui) subCommitsListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
WindowName: "branches",
|
WindowName: "branches",
|
||||||
Key: SUB_COMMITS_CONTEXT_KEY,
|
Key: context.SUB_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.SubCommits) },
|
GetItemsLength: func() int { return len(gui.State.SubCommits) },
|
||||||
|
@ -205,7 +205,7 @@ func (gui *Gui) subCommitsListContext() types.IListContext {
|
||||||
Gui: gui,
|
Gui: gui,
|
||||||
GetDisplayStrings: func(startIdx int, length int) [][]string {
|
GetDisplayStrings: func(startIdx int, length int) [][]string {
|
||||||
selectedCommitSha := ""
|
selectedCommitSha := ""
|
||||||
if gui.currentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY {
|
if gui.currentContext().GetKey() == context.SUB_COMMITS_CONTEXT_KEY {
|
||||||
selectedCommit := gui.getSelectedSubCommit()
|
selectedCommit := gui.getSelectedSubCommit()
|
||||||
if selectedCommit != nil {
|
if selectedCommit != nil {
|
||||||
selectedCommitSha = selectedCommit.Sha
|
selectedCommitSha = selectedCommit.Sha
|
||||||
|
@ -257,7 +257,7 @@ func (gui *Gui) reflogCommitsListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
WindowName: "commits",
|
WindowName: "commits",
|
||||||
Key: REFLOG_COMMITS_CONTEXT_KEY,
|
Key: context.REFLOG_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) },
|
GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) },
|
||||||
|
@ -285,7 +285,7 @@ func (gui *Gui) stashListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "stash",
|
ViewName: "stash",
|
||||||
WindowName: "stash",
|
WindowName: "stash",
|
||||||
Key: STASH_CONTEXT_KEY,
|
Key: context.STASH_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.StashEntries) },
|
GetItemsLength: func() int { return len(gui.State.StashEntries) },
|
||||||
|
@ -307,7 +307,7 @@ func (gui *Gui) commitFilesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "commitFiles",
|
ViewName: "commitFiles",
|
||||||
WindowName: "commits",
|
WindowName: "commits",
|
||||||
Key: COMMIT_FILES_CONTEXT_KEY,
|
Key: context.COMMIT_FILES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return gui.State.CommitFileTreeViewModel.GetItemsLength() },
|
GetItemsLength: func() int { return gui.State.CommitFileTreeViewModel.GetItemsLength() },
|
||||||
|
@ -340,7 +340,7 @@ func (gui *Gui) submodulesListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "files",
|
ViewName: "files",
|
||||||
WindowName: "files",
|
WindowName: "files",
|
||||||
Key: SUBMODULES_CONTEXT_KEY,
|
Key: context.SUBMODULES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.Submodules) },
|
GetItemsLength: func() int { return len(gui.State.Submodules) },
|
||||||
|
@ -362,7 +362,7 @@ func (gui *Gui) suggestionsListContext() types.IListContext {
|
||||||
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
BaseContext: context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
ViewName: "suggestions",
|
ViewName: "suggestions",
|
||||||
WindowName: "suggestions",
|
WindowName: "suggestions",
|
||||||
Key: SUGGESTIONS_CONTEXT_KEY,
|
Key: context.SUGGESTIONS_CONTEXT_KEY,
|
||||||
Kind: types.PERSISTENT_POPUP,
|
Kind: types.PERSISTENT_POPUP,
|
||||||
}),
|
}),
|
||||||
GetItemsLength: func() int { return len(gui.State.Suggestions) },
|
GetItemsLength: func() int { return len(gui.State.Suggestions) },
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
@ -287,7 +288,7 @@ func (gui *Gui) refreshMergeState() error {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Panels.Merging.Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Panels.Merging.Unlock()
|
||||||
|
|
||||||
if gui.currentContext().GetKey() != MAIN_MERGING_CONTEXT_KEY {
|
if gui.currentContext().GetKey() != context.MAIN_MERGING_CONTEXT_KEY {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ func (gui *Gui) validateNormalWorkingTreeState() (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) returnFocusFromLineByLinePanelIfNecessary() error {
|
func (gui *Gui) returnFocusFromLineByLinePanelIfNecessary() error {
|
||||||
if gui.State.MainContext == MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
if gui.State.MainContext == context.MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
||||||
return gui.handleEscapePatchBuildingPanel()
|
return gui.handleEscapePatchBuildingPanel()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -188,7 +189,7 @@ func (gui *Gui) handleApplyPatch(reverse bool) error {
|
||||||
|
|
||||||
func (gui *Gui) handleResetPatch() error {
|
func (gui *Gui) handleResetPatch() error {
|
||||||
gui.git.Patch.PatchManager.Reset()
|
gui.git.Patch.PatchManager.Reset()
|
||||||
if gui.currentContextKeyIgnoringPopups() == MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
if gui.currentContextKeyIgnoringPopups() == context.MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
||||||
if err := gui.c.PushContext(gui.State.Contexts.CommitFiles); err != nil {
|
if err := gui.c.PushContext(gui.State.Contexts.CommitFiles); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue