summaryrefslogtreecommitdiffstats
path: root/pkg/gui/staging_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-16 14:46:53 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit1dd7307fde033dae5fececac15810a99e26c3d91 (patch)
tree4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/staging_panel.go
parenta90b6efded49abcfa2516db794d7875b0396f558 (diff)
start moving commit panel handlers into controller
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers
Diffstat (limited to 'pkg/gui/staging_panel.go')
-rw-r--r--pkg/gui/staging_panel.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/pkg/gui/staging_panel.go b/pkg/gui/staging_panel.go
index f4cd98ea2..f04f1e3ff 100644
--- a/pkg/gui/staging_panel.go
+++ b/pkg/gui/staging_panel.go
@@ -28,16 +28,16 @@ func (gui *Gui) refreshStagingPanel(forceSecondaryFocused bool, selectedLineIdx
}
if secondaryFocused {
- gui.Views.Main.Title = gui.Tr.StagedChanges
- gui.Views.Secondary.Title = gui.Tr.UnstagedChanges
+ gui.Views.Main.Title = gui.c.Tr.StagedChanges
+ gui.Views.Secondary.Title = gui.c.Tr.UnstagedChanges
} else {
- gui.Views.Main.Title = gui.Tr.UnstagedChanges
- gui.Views.Secondary.Title = gui.Tr.StagedChanges
+ gui.Views.Main.Title = gui.c.Tr.UnstagedChanges
+ gui.Views.Secondary.Title = gui.c.Tr.StagedChanges
}
// note for custom diffs, we'll need to send a flag here saying not to use the custom diff
- diff := gui.Git.WorkingTree.WorktreeFileDiff(file, true, secondaryFocused, false)
- secondaryDiff := gui.Git.WorkingTree.WorktreeFileDiff(file, true, !secondaryFocused, false)
+ diff := gui.git.WorkingTree.WorktreeFileDiff(file, true, secondaryFocused, false)
+ secondaryDiff := gui.git.WorkingTree.WorktreeFileDiff(file, true, !secondaryFocused, false)
// if we have e.g. a deleted file with nothing else to the diff will have only
// 4-5 lines in which case we'll swap panels
@@ -97,7 +97,7 @@ func (gui *Gui) handleTogglePanel() error {
func (gui *Gui) handleStagingEscape() error {
gui.escapeLineByLinePanel()
- return gui.pushContext(gui.State.Contexts.Files)
+ return gui.c.PushContext(gui.State.Contexts.Files)
}
func (gui *Gui) handleToggleStagedSelection() error {
@@ -113,10 +113,10 @@ func (gui *Gui) handleResetSelection() error {
return gui.applySelection(true, state)
}
- if !gui.UserConfig.Gui.SkipUnstageLineWarning {
- return gui.PopupHandler.Ask(popup.AskOpts{
- Title: gui.Tr.UnstageLinesTitle,
- Prompt: gui.Tr.UnstageLinesPrompt,
+ if !gui.c.UserConfig.Gui.SkipUnstageLineWarning {
+ return gui.c.Ask(popup.AskOpts{
+ Title: gui.c.Tr.UnstageLinesTitle,
+ Prompt: gui.c.Tr.UnstageLinesPrompt,
HandleConfirm: func() error {
return gui.withLBLActiveCheck(func(state *LblPanelState) error {
return gui.applySelection(true, state)
@@ -148,17 +148,17 @@ func (gui *Gui) applySelection(reverse bool, state *LblPanelState) error {
if !reverse || state.SecondaryFocused {
applyFlags = append(applyFlags, "cached")
}
- gui.logAction(gui.Tr.Actions.ApplyPatch)
- err := gui.Git.WorkingTree.ApplyPatch(patch, applyFlags...)
+ gui.c.LogAction(gui.c.Tr.Actions.ApplyPatch)
+ err := gui.git.WorkingTree.ApplyPatch(patch, applyFlags...)
if err != nil {
- return gui.PopupHandler.Error(err)
+ return gui.c.Error(err)
}
if state.SelectingRange() {
state.SetLineSelectMode()
}
- if err := gui.refreshSidePanels(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}}); err != nil {
+ if err := gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}}); err != nil {
return err
}
if err := gui.refreshStagingPanel(false, -1); err != nil {