mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02: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:
parent
3ca1292fb4
commit
9df634f13f
5 changed files with 46 additions and 24 deletions
|
@ -36,6 +36,9 @@ gui:
|
|||
- bold
|
||||
inactiveBorderColor:
|
||||
- white
|
||||
searchingActiveBorderColor:
|
||||
- cyan
|
||||
- bold
|
||||
optionsTextColor:
|
||||
- blue
|
||||
selectedLineBgColor:
|
||||
|
|
|
@ -62,6 +62,7 @@ type GuiConfig struct {
|
|||
type ThemeConfig struct {
|
||||
ActiveBorderColor []string `yaml:"activeBorderColor"`
|
||||
InactiveBorderColor []string `yaml:"inactiveBorderColor"`
|
||||
SearchingActiveBorderColor []string `yaml:"searchingActiveBorderColor"`
|
||||
OptionsTextColor []string `yaml:"optionsTextColor"`
|
||||
SelectedLineBgColor []string `yaml:"selectedLineBgColor"`
|
||||
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
||||
|
@ -410,6 +411,7 @@ func GetDefaultConfig() *UserConfig {
|
|||
ShortTimeFormat: time.Kitchen,
|
||||
Theme: ThemeConfig{
|
||||
ActiveBorderColor: []string{"green", "bold"},
|
||||
SearchingActiveBorderColor: []string{"cyan", "bold"},
|
||||
InactiveBorderColor: []string{"default"},
|
||||
OptionsTextColor: []string{"blue"},
|
||||
SelectedLineBgColor: []string{"blue"},
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -91,10 +91,14 @@ func (gui *Gui) createAllViews() error {
|
|||
gui.Views.Options.Frame = false
|
||||
|
||||
gui.Views.SearchPrefix.BgColor = gocui.ColorDefault
|
||||
gui.Views.SearchPrefix.FgColor = gocui.ColorGreen
|
||||
gui.Views.SearchPrefix.FgColor = gocui.ColorCyan
|
||||
gui.Views.SearchPrefix.Frame = false
|
||||
gui.c.SetViewContent(gui.Views.SearchPrefix, gui.Tr.SearchPrefix)
|
||||
|
||||
gui.Views.Search.BgColor = gocui.ColorDefault
|
||||
gui.Views.Search.FgColor = gocui.ColorCyan
|
||||
gui.Views.Search.Editable = true
|
||||
gui.Views.Search.Frame = false
|
||||
gui.Views.Search.Editor = gocui.EditorFunc(gui.searchEditor)
|
||||
|
||||
gui.Views.Stash.Title = gui.c.Tr.StashTitle
|
||||
|
@ -143,11 +147,6 @@ func (gui *Gui) createAllViews() error {
|
|||
|
||||
gui.Views.Status.Title = gui.c.Tr.StatusTitle
|
||||
|
||||
gui.Views.Search.BgColor = gocui.ColorDefault
|
||||
gui.Views.Search.FgColor = gocui.ColorGreen
|
||||
gui.Views.Search.Editable = true
|
||||
gui.Views.Search.Frame = false
|
||||
|
||||
gui.Views.AppStatus.BgColor = gocui.ColorDefault
|
||||
gui.Views.AppStatus.FgColor = gocui.ColorCyan
|
||||
gui.Views.AppStatus.Visible = false
|
||||
|
|
|
@ -19,6 +19,9 @@ var (
|
|||
// InactiveBorderColor is the border color of the inactive active frames
|
||||
InactiveBorderColor gocui.Attribute
|
||||
|
||||
// FilteredActiveBorderColor is the border color of the active frame, when it's being searched/filtered
|
||||
SearchingActiveBorderColor gocui.Attribute
|
||||
|
||||
// GocuiSelectedLineBgColor is the background color for the selected line in gocui
|
||||
GocuiSelectedLineBgColor gocui.Attribute
|
||||
|
||||
|
@ -44,6 +47,7 @@ var (
|
|||
func UpdateTheme(themeConfig config.ThemeConfig) {
|
||||
ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor)
|
||||
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
|
||||
SearchingActiveBorderColor = GetGocuiStyle(themeConfig.SearchingActiveBorderColor)
|
||||
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)
|
||||
SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue