1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Color view frame differently when searching/filtering

Given that we now persist search/filter states even after a side context loses focus, we need to make it really
clear to the user that the context is currently being searched/filtered
This commit is contained in:
Jesse Duffield
2023-06-03 14:11:03 +10:00
parent 3ca1292fb4
commit 9df634f13f
5 changed files with 46 additions and 24 deletions

View File

@ -201,11 +201,13 @@ func (self *SearchHelper) OnPromptContentChanged(searchString string) {
func (self *SearchHelper) DisplaySearchStatusIfSearching(c types.Context) {
if searchableContext, ok := c.(types.ISearchableContext); ok {
if searchableContext.IsSearching() {
self.setSearchingFrameColor()
self.DisplaySearchStatus(searchableContext)
}
}
if filterableContext, ok := c.(types.IFilterableContext); ok {
if filterableContext.IsFiltering() {
self.setSearchingFrameColor()
self.DisplayFilterStatus(filterableContext)
}
}
@ -232,6 +234,18 @@ func (self *SearchHelper) CancelSearchIfSearching(c types.Context) {
}
func (self *SearchHelper) HidePrompt() {
self.setNonSearchingFrameColor()
state := self.searchState()
state.Context = nil
}
func (self *SearchHelper) setSearchingFrameColor() {
self.c.GocuiGui().SelFgColor = theme.SearchingActiveBorderColor
self.c.GocuiGui().SelFrameColor = theme.SearchingActiveBorderColor
}
func (self *SearchHelper) setNonSearchingFrameColor() {
self.c.GocuiGui().SelFgColor = theme.ActiveBorderColor
self.c.GocuiGui().SelFrameColor = theme.ActiveBorderColor
}