mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
Add integration tests for searching/filtering
This commit is contained in:
@@ -201,7 +201,6 @@ func (self *ContextMgr) deactivateContext(c types.Context, opts types.OnFocusLos
|
||||
view, _ := self.gui.c.GocuiGui().View(c.GetViewName())
|
||||
|
||||
if opts.NewContextKey != context.SEARCH_CONTEXT_KEY {
|
||||
self.gui.helpers.Search.HidePrompt()
|
||||
if c.GetKind() == types.MAIN_CONTEXT || c.GetKind() == types.TEMPORARY_POPUP {
|
||||
self.gui.helpers.Search.CancelSearchIfSearching(c)
|
||||
}
|
||||
@@ -235,7 +234,7 @@ func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts)
|
||||
return err
|
||||
}
|
||||
|
||||
self.gui.helpers.Search.DisplaySearchStatusIfSearching(c)
|
||||
self.gui.helpers.Search.RenderSearchStatus(c)
|
||||
|
||||
desiredTitle := c.Title()
|
||||
if desiredTitle != "" {
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
"github.com/jesseduffield/lazygit/pkg/theme"
|
||||
@@ -198,19 +199,27 @@ func (self *SearchHelper) OnPromptContentChanged(searchString string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SearchHelper) DisplaySearchStatusIfSearching(c types.Context) {
|
||||
func (self *SearchHelper) RenderSearchStatus(c types.Context) {
|
||||
if c.GetKey() == context.SEARCH_CONTEXT_KEY {
|
||||
return
|
||||
}
|
||||
|
||||
if searchableContext, ok := c.(types.ISearchableContext); ok {
|
||||
if searchableContext.IsSearching() {
|
||||
self.setSearchingFrameColor()
|
||||
self.DisplaySearchStatus(searchableContext)
|
||||
return
|
||||
}
|
||||
}
|
||||
if filterableContext, ok := c.(types.IFilterableContext); ok {
|
||||
if filterableContext.IsFiltering() {
|
||||
self.setSearchingFrameColor()
|
||||
self.DisplayFilterStatus(filterableContext)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
self.HidePrompt()
|
||||
}
|
||||
|
||||
func (self *SearchHelper) CancelSearchIfSearching(c types.Context) {
|
||||
|
Reference in New Issue
Block a user