summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r--pkg/gui/gui.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 1ae9199eb..fd4e6bfd4 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -214,6 +214,21 @@ type guiState struct {
PrevMainWidth int
PrevMainHeight int
OldInformation string
+
+ Undo UndoState
+}
+
+// we facilitate 'undo' actions via parsing the reflog and doing the reverse
+// of the most recent entry. In order to to multiple undo's in a row we need to
+// keep track of where we are in the reflog. We do that via a key which is the
+// concatenation of the reflog's timestamp and message.
+// We also store the index of that reflog entry so that if we end up with a
+// different entry at that index we know the user must have done something
+// themselves (e.g. checked out a branch) to cause new reflog entries to be created
+// meaning we can reset the undo state.
+type UndoState struct {
+ ReflogKey string
+ ReflogIdx int
}
// for now the split view will always be on