diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-22 11:44:03 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | c2b154acad4e1040bdc0e09cf44733ccd877923b (patch) | |
tree | d963fb7f4cdb405c8dfa610c94835d5c00822498 /pkg/gui/gui.go | |
parent | fbd61fcd17d495e9605bcf1f765663f861839cac (diff) |
better handling of our different modes and also cherry picking
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 7cebf5362..d7ae574e9 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -232,12 +232,27 @@ type Diffing struct { Reverse bool } +func (m *Diffing) Active() bool { + return m.Ref != "" +} + type Filtering struct { Path string // the filename that gets passed to git log } +func (m *Filtering) Active() bool { + return m.Path != "" +} + type CherryPicking struct { CherryPickedCommits []*commands.Commit + + // we only allow cherry picking from one context at a time, so you can't copy a commit from the local commits context and then also copy a commit in the reflog context + ContextKey string +} + +func (m *CherryPicking) Active() bool { + return len(m.CherryPickedCommits) > 0 } type Modes struct { @@ -309,6 +324,7 @@ func (gui *Gui) resetState() { }, CherryPicking: CherryPicking{ CherryPickedCommits: make([]*commands.Commit, 0), + ContextKey: "", }, Diffing: prevDiff, } @@ -383,7 +399,7 @@ func (gui *Gui) Run() error { } defer g.Close() - if gui.inFilterMode() { + if gui.State.Modes.Filtering.Active() { gui.State.ScreenMode = SCREEN_HALF } else { gui.State.ScreenMode = SCREEN_NORMAL |