Fix ANSI attributes lost when 'regular' attribute is set to fg or nth

Examples:

  echo -e "\x1b[33;3mfoo \x1b[mbar" | fzf --ansi --color fg:regular
  echo -e "\x1b[33;3mfoo \x1b[mbar" | fzf --ansi --color nth:regular
This commit is contained in:
Junegunn Choi
2025-05-30 20:42:55 +09:00
parent 1ecfa38eee
commit a9d1d42436

View File

@@ -13,10 +13,10 @@ var DefaultBorderShape = BorderRounded
func (a Attr) Merge(b Attr) Attr {
if b&AttrRegular > 0 {
// Only keep bold attribute set by the system
return b | (a & BoldForce)
return (b &^ AttrRegular) | (a & BoldForce)
}
return a | b
return (a &^ AttrRegular) | b
}
const (