diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-09-20 16:09:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 16:09:53 +1000 |
commit | 276438b6018a2976386a9745be57c15473ddded6 (patch) | |
tree | aea459b1f2bb0a05ee404da6b0611c1156a0e239 /pkg/gui/types | |
parent | 1aae1772ce38758d1c3d944afb771b1ee6f189b1 (diff) | |
parent | edec116cebe6dde1f8e7ce375fabc407c84d92b5 (diff) |
Add history for search view (#2877)
Diffstat (limited to 'pkg/gui/types')
-rw-r--r-- | pkg/gui/types/context.go | 9 | ||||
-rw-r--r-- | pkg/gui/types/search_state.go | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index 7aa07056e..fbc38df82 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -4,6 +4,7 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/gui/patch_exploring" + "github.com/jesseduffield/lazygit/pkg/utils" "github.com/sasha-s/go-deadlock" ) @@ -87,9 +88,16 @@ type Context interface { HandleRenderToMain() error } +type ISearchHistoryContext interface { + Context + + GetSearchHistory() *utils.HistoryBuffer[string] +} + type IFilterableContext interface { Context IListPanelState + ISearchHistoryContext SetFilter(string) GetFilter() string @@ -100,6 +108,7 @@ type IFilterableContext interface { type ISearchableContext interface { Context + ISearchHistoryContext SetSearchString(string) GetSearchString() string diff --git a/pkg/gui/types/search_state.go b/pkg/gui/types/search_state.go index 9b24af095..af806f2c3 100644 --- a/pkg/gui/types/search_state.go +++ b/pkg/gui/types/search_state.go @@ -12,11 +12,12 @@ const ( // TODO: could we remove this entirely? type SearchState struct { - Context Context + Context Context + PrevSearchIndex int } func NewSearchState() *SearchState { - return &SearchState{} + return &SearchState{PrevSearchIndex: -1} } func (self *SearchState) SearchType() SearchType { |