highlight error in statusline

This commit is contained in:
booleanmaybe 2026-04-08 12:43:20 -04:00
parent 381f98c3af
commit 7045d51003
4 changed files with 16 additions and 9 deletions

View file

@ -203,7 +203,7 @@ func DefaultColors() *ColorConfig {
StatuslineAccentFg: "#2e3440", // Nord polar night 1
StatuslineInfoFg: "#a3be8c", // Nord aurora green
StatuslineInfoBg: "#3b4252", // Nord polar night 2
StatuslineErrorFg: "#bf616a", // Nord aurora red
StatuslineErrorFg: "#ffff00", // yellow, matches header global key color
StatuslineErrorBg: "#3b4252", // Nord polar night 2
StatuslineFillBg: "#3b4252", // Nord polar night 2
}

View file

@ -20,7 +20,7 @@ type StatuslineConfig struct {
// right section: transient message
message string
level MessageLevel
autoHide bool // if true, entire bar hides on next keypress
autoHide bool // if true, message is dismissed on next keypress
// visibility
visible bool
@ -123,7 +123,7 @@ func (sc *StatuslineConfig) SetViewStats(stats map[string]StatValue) {
}
// SetMessage sets the right-section message with a severity level. If autoHide
// is true, the entire statusline will hide on the next keypress (via DismissAutoHide).
// is true, the message is dismissed on the next keypress (via DismissAutoHide).
// Setting a message makes the statusline visible.
func (sc *StatuslineConfig) SetMessage(text string, level MessageLevel, autoHide bool) {
sc.mu.Lock()
@ -156,8 +156,8 @@ func (sc *StatuslineConfig) ClearMessage() {
}
// DismissAutoHide is called on every keypress. If auto-hide is active,
// it hides the entire statusline and clears the message. Returns true
// if the statusline was dismissed.
// it clears the message but keeps the statusline bar visible. Returns true
// if a message was dismissed.
func (sc *StatuslineConfig) DismissAutoHide() bool {
sc.mu.Lock()
if !sc.autoHide {
@ -167,7 +167,6 @@ func (sc *StatuslineConfig) DismissAutoHide() bool {
sc.autoHide = false
sc.message = ""
sc.level = MessageLevelInfo
sc.visible = false
sc.mu.Unlock()
sc.notifyListeners()
return true

View file

@ -197,9 +197,9 @@ func TestStatuslineConfig_DismissAutoHide(t *testing.T) {
t.Error("DismissAutoHide() = false, want true")
}
// statusline should now be hidden
if sc.IsVisible() {
t.Error("statusline should be hidden after DismissAutoHide")
// statusline should remain visible (only the message is dismissed)
if !sc.IsVisible() {
t.Error("statusline should remain visible after DismissAutoHide")
}
// message should be cleared

View file

@ -663,6 +663,14 @@ func TestTriggerEngine_BeforeDeleteUnconditionalDeny(t *testing.T) {
func TestLoadAndRegisterTriggers_EmptyDefs(t *testing.T) {
// no workflow files → empty defs → engine, 0, nil
// isolate from real user/project workflow.yaml files
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
originalDir, _ := os.Getwd()
t.Cleanup(func() { _ = os.Chdir(originalDir) })
_ = os.Chdir(t.TempDir())
config.ResetPathManager()
gate := NewTaskMutationGate()
schema := testTriggerSchema{}
engine, count, err := LoadAndRegisterTriggers(gate, schema, nil)