applyMatchOrHint function

({int bg, int fg}) applyMatchOrHint(
  1. int flags,
  2. ({int bg, int fg}) ec,
  3. SearchColors search,
  4. HintColors hint,
)

Effective fg/bg with full precedence: focused-match > match > hyperlink > base.

Implementation

({int fg, int bg}) applyMatchOrHint(
    int flags, ({int fg, int bg}) ec, SearchColors search, HintColors hint) {
  if (flags & kFlagMatchCurrent != 0) {
    return (fg: search.focusedFg, bg: search.focusedBg);
  }
  if (flags & kFlagMatch != 0) {
    return (fg: search.matchFg, bg: search.matchBg);
  }
  if (flags & kFlagHyperlink != 0) {
    return (fg: hint.fg, bg: hint.bg);
  }
  return ec;
}