summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-06 14:21:17 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commitfbab5bd444768b8151e76336e6070f554eec8fea (patch)
tree78c14239739b5453ac892d25d8ea36da2ad4fe8a
parent12ca922a410688646cfea3289b56e0fec83aae88 (diff)
do not refresh patch panel unless commit files panel is the current side panel
-rw-r--r--pkg/gui/commit_files_panel.go6
-rw-r--r--pkg/gui/context.go33
-rw-r--r--pkg/utils/utils.go7
3 files changed, 32 insertions, 14 deletions
diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go
index d50eefb23..d34d1a14d 100644
--- a/pkg/gui/commit_files_panel.go
+++ b/pkg/gui/commit_files_panel.go
@@ -94,8 +94,10 @@ func (gui *Gui) handleDiscardOldFileChange() error {
}
func (gui *Gui) refreshCommitFilesView() error {
- if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
- return err
+ if gui.currentSideContext().GetKey() == COMMIT_FILES_CONTEXT_KEY {
+ if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil {
+ return err
+ }
}
to := gui.State.Panels.CommitFiles.refName
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index a06fae4a7..736f773b7 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -780,18 +780,6 @@ func (gui *Gui) rerenderView(view *gocui.View) error {
return context.HandleRender()
}
-// currently unused
-// func (gui *Gui) getCurrentSideView() *gocui.View {
-// currentSideContext := gui.currentSideContext()
-// if currentSideContext == nil {
-// return nil
-// }
-
-// view, _ := gui.g.View(currentSideContext.GetViewName())
-
-// return view
-// }
-
func (gui *Gui) getSideContextSelectedItemId() string {
currentSideContext := gui.currentSideListContext()
if currentSideContext == nil {
@@ -806,3 +794,24 @@ func (gui *Gui) getSideContextSelectedItemId() string {
return ""
}
+
+// currently unused
+// func (gui *Gui) getCurrentSideView() *gocui.View {
+// currentSideContext := gui.currentSideContext()
+// if currentSideContext == nil {
+// return nil
+// }
+
+// view, _ := gui.g.View(currentSideContext.GetViewName())
+
+// return view
+// }
+
+// currently unused
+// func (gui *Gui) renderContextStack() string {
+// result := ""
+// for _, context := range gui.State.ContextManager.ContextStack {
+// result += context.GetViewName() + "\n"
+// }
+// return result
+// }
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index 945586001..69fe711ac 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"regexp"
+ "runtime"
"strconv"
"strings"
"text/template"
@@ -382,3 +383,9 @@ func SafeWithError(f func() error) error {
return err
}
+
+func StackTrace() string {
+ buf := make([]byte, 10000)
+ n := runtime.Stack(buf, false)
+ return fmt.Sprintf("%s\n", buf[:n])
+}