From a974fe990f7e1704ff8f0b985e87d0f498907916 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 11 Apr 2026 13:22:25 +0800 Subject: [PATCH] fish_color_valid_path: respect explicit normal foreground --- src/highlight/highlight.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/highlight/highlight.rs b/src/highlight/highlight.rs index c95593099..baf6f9a90 100644 --- a/src/highlight/highlight.rs +++ b/src/highlight/highlight.rs @@ -189,13 +189,10 @@ fn resolve_spec_uncached(highlight: &HighlightSpec, vars: &dyn Environment) -> T // Handle modifiers. if highlight.valid_path { if let Some(valid_path_var) = vars.get(L!("fish_color_valid_path")) { + let valid_path_face = parse_text_face(valid_path_var.as_list()); // Historical behavior is to not apply background. - let valid_path_face = parse_text_face_for_highlight(&valid_path_var) - .unwrap_or(TextFace::terminal_default()); - // Apply the foreground, except if it's normal. The intention here is likely - // to only override foreground if the valid path color has an explicit foreground. - if !valid_path_face.fg.is_normal() { - face.fg = valid_path_face.fg; + if let Some(fg) = valid_path_face.fg { + face.fg = fg; } face.style = face.style.union_prefer_right(valid_path_face.style); }