mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-04 23:37:41 +02:00
cleanup
This commit is contained in:
parent
0dd2c869a8
commit
ade54b38c1
@ -36,6 +36,7 @@ type PatchManager struct {
|
|||||||
Reverse bool
|
Reverse bool
|
||||||
|
|
||||||
// CanRebase tells us whether we're allowed to modify our commits. CanRebase should be true for commits of the currently checked out branch and false for everything else
|
// CanRebase tells us whether we're allowed to modify our commits. CanRebase should be true for commits of the currently checked out branch and false for everything else
|
||||||
|
// TODO: move this out into a proper mode struct in the gui package: it doesn't really belong here
|
||||||
CanRebase bool
|
CanRebase bool
|
||||||
|
|
||||||
// fileInfoMap starts empty but you add files to it as you go along
|
// fileInfoMap starts empty but you add files to it as you go along
|
||||||
|
@ -210,7 +210,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
},
|
},
|
||||||
Kind: MAIN_CONTEXT,
|
Kind: MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: "normal",
|
Key: MAIN_NORMAL_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Staging: SimpleContextNode{
|
Staging: SimpleContextNode{
|
||||||
@ -222,7 +222,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
},
|
},
|
||||||
Kind: MAIN_CONTEXT,
|
Kind: MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: "staging",
|
Key: MAIN_STAGING_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PatchBuilding: SimpleContextNode{
|
PatchBuilding: SimpleContextNode{
|
||||||
@ -234,7 +234,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
},
|
},
|
||||||
Kind: MAIN_CONTEXT,
|
Kind: MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: "patchBuilding",
|
Key: MAIN_PATCH_BUILDING_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Merging: SimpleContextNode{
|
Merging: SimpleContextNode{
|
||||||
@ -246,7 +246,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
},
|
},
|
||||||
Kind: MAIN_CONTEXT,
|
Kind: MAIN_CONTEXT,
|
||||||
ViewName: "main",
|
ViewName: "main",
|
||||||
Key: "merging",
|
Key: MAIN_MERGING_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Credentials: SimpleContextNode{
|
Credentials: SimpleContextNode{
|
||||||
@ -254,7 +254,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
OnFocus: func() error { return gui.handleCredentialsViewFocused() },
|
OnFocus: func() error { return gui.handleCredentialsViewFocused() },
|
||||||
Kind: PERSISTENT_POPUP,
|
Kind: PERSISTENT_POPUP,
|
||||||
ViewName: "credentials",
|
ViewName: "credentials",
|
||||||
Key: "credentials",
|
Key: CREDENTIALS_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Confirmation: SimpleContextNode{
|
Confirmation: SimpleContextNode{
|
||||||
@ -262,7 +262,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
OnFocus: func() error { return nil },
|
OnFocus: func() error { return nil },
|
||||||
Kind: TEMPORARY_POPUP,
|
Kind: TEMPORARY_POPUP,
|
||||||
ViewName: "confirmation",
|
ViewName: "confirmation",
|
||||||
Key: "confirmation",
|
Key: CONFIRMATION_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
CommitMessage: SimpleContextNode{
|
CommitMessage: SimpleContextNode{
|
||||||
@ -270,7 +270,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
OnFocus: func() error { return gui.handleCommitMessageFocused() },
|
OnFocus: func() error { return gui.handleCommitMessageFocused() },
|
||||||
Kind: PERSISTENT_POPUP,
|
Kind: PERSISTENT_POPUP,
|
||||||
ViewName: "commitMessage",
|
ViewName: "commitMessage",
|
||||||
Key: "commitMessage",
|
Key: COMMIT_MESSAGE_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Search: SimpleContextNode{
|
Search: SimpleContextNode{
|
||||||
@ -278,7 +278,7 @@ func (gui *Gui) contextTree() ContextTree {
|
|||||||
OnFocus: func() error { return nil },
|
OnFocus: func() error { return nil },
|
||||||
Kind: PERSISTENT_POPUP,
|
Kind: PERSISTENT_POPUP,
|
||||||
ViewName: "search",
|
ViewName: "search",
|
||||||
Key: "search",
|
Key: SEARCH_CONTEXT_KEY,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -232,13 +232,12 @@ func (lc *ListContext) onSearchSelect(selectedLineIdx int) error {
|
|||||||
|
|
||||||
func (gui *Gui) menuListContext() *ListContext {
|
func (gui *Gui) menuListContext() *ListContext {
|
||||||
return &ListContext{
|
return &ListContext{
|
||||||
ViewName: "menu",
|
ViewName: "menu",
|
||||||
ContextKey: "menu",
|
ContextKey: "menu",
|
||||||
GetItemsLength: func() int { return gui.getMenuView().LinesHeight() },
|
GetItemsLength: func() int { return gui.getMenuView().LinesHeight() },
|
||||||
GetPanelState: func() IListPanelState { return gui.State.Panels.Menu },
|
GetPanelState: func() IListPanelState { return gui.State.Panels.Menu },
|
||||||
OnFocus: gui.handleMenuSelect,
|
OnFocus: gui.handleMenuSelect,
|
||||||
// need to add a layer of indirection here because the callback changes during runtime
|
OnClickSelectedItem: func() error { return gui.onMenuPress() },
|
||||||
OnClickSelectedItem: func() error { return gui.State.Panels.Menu.OnPress() },
|
|
||||||
Gui: gui,
|
Gui: gui,
|
||||||
ResetMainViewOriginOnFocus: false,
|
ResetMainViewOriginOnFocus: false,
|
||||||
Kind: PERSISTENT_POPUP,
|
Kind: PERSISTENT_POPUP,
|
||||||
|
@ -42,7 +42,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
|||||||
},
|
},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
if gui.currentContext() == gui.Contexts.BranchCommits.Context {
|
if gui.currentContext().GetKey() == gui.Contexts.BranchCommits.Context.GetKey() {
|
||||||
selectedCommit := gui.getSelectedLocalCommit()
|
selectedCommit := gui.getSelectedLocalCommit()
|
||||||
if selectedCommit != nil && gui.GitCommand.PatchManager.To != selectedCommit.Sha {
|
if selectedCommit != nil && gui.GitCommand.PatchManager.To != selectedCommit.Sha {
|
||||||
// adding this option to index 1
|
// adding this option to index 1
|
||||||
@ -84,7 +84,7 @@ func (gui *Gui) validateNormalWorkingTreeState() (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) returnFocusFromLineByLinePanelIfNecessary() error {
|
func (gui *Gui) returnFocusFromLineByLinePanelIfNecessary() error {
|
||||||
if gui.State.MainContext == "patchBuilding" {
|
if gui.State.MainContext == MAIN_PATCH_BUILDING_CONTEXT_KEY {
|
||||||
return gui.handleEscapePatchBuildingPanel()
|
return gui.handleEscapePatchBuildingPanel()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -107,7 +107,5 @@ func (gui *Gui) handleSwitchToSubCommits() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.Log.Warn(currentContext.GetKey())
|
|
||||||
|
|
||||||
return gui.switchToSubCommitsContext(currentContext.GetSelectedItemId())
|
return gui.switchToSubCommitsContext(currentContext.GetSelectedItemId())
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ package gui
|
|||||||
// A view is a box that renders content, and within a window only one view will
|
// A view is a box that renders content, and within a window only one view will
|
||||||
// appear at a time. When a view appears within a window, it occupies the whole
|
// appear at a time. When a view appears within a window, it occupies the whole
|
||||||
// space. Right now most windows are 1:1 with views, except for commitFiles which
|
// space. Right now most windows are 1:1 with views, except for commitFiles which
|
||||||
// is a view belonging to the 'commits' window, alongside the 'commits' view.
|
// is a view that moves between windows
|
||||||
|
|
||||||
func (gui *Gui) getViewNameForWindow(window string) string {
|
func (gui *Gui) getViewNameForWindow(window string) string {
|
||||||
viewName, ok := gui.State.WindowViewNameMap[window]
|
viewName, ok := gui.State.WindowViewNameMap[window]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user