From af09223dd5cd50c5b2a2fe846632a7a0a6e02e1e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Thu, 1 Apr 2021 00:24:41 +1100 Subject: [PATCH] refactor --- pkg/gui/gui.go | 7 ++----- pkg/gui/list_context.go | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 671321d54..9fe5e4259 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -102,11 +102,6 @@ func (h *listPanelState) GetSelectedLineIdx() int { return h.SelectedLineIdx } -type IListPanelState interface { - SetSelectedLineIdx(int) - GetSelectedLineIdx() int -} - // for now the staging panel state, unlike the other panel states, is going to be // non-mutative, so that we don't accidentally end up // with mismatches of data. We might change this in the future @@ -271,6 +266,8 @@ type guiStateMutexes struct { } type guiState struct { + // the file panels (files and commit files) can render as a tree, so we have + // managers for them which handle rendering a flat list of files in tree form FileManager *filetree.FileManager CommitFileManager *filetree.CommitFileManager Submodules []*models.SubmoduleConfig diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 39fa8f6bf..ac345dd97 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -30,6 +30,11 @@ type ListContext struct { WindowName string } +type IListPanelState interface { + SetSelectedLineIdx(int) + GetSelectedLineIdx() int +} + type ListItem interface { // ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch ID() string