fix(terminal-search): make Cmd+F match highlights high-contrast (#756)

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
This commit is contained in:
Matt Van Horn 2026-04-18 15:20:15 -07:00 committed by GitHub
parent c57c55b9b8
commit 3918e4cfcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,8 +22,26 @@ export default function TerminalSearch({
const [caseSensitive, setCaseSensitive] = useState(false)
const [regex, setRegex] = useState(false)
// Why: the default xterm SearchAddon highlights blend into common
// terminal backgrounds (see orca#612). Providing explicit decoration
// colors gives all matches a visible yellow background and the
// current match a brighter orange, matching the contrast VS Code and
// iTerm2 use for terminal search. xterm requires #RRGGBB format for
// the background colors.
const searchOptions = useCallback(
(incremental = false) => ({ caseSensitive, regex, incremental }),
(incremental: boolean = false) => ({
caseSensitive,
regex,
incremental,
decorations: {
matchBackground: '#5c4a00',
matchBorder: '#5c4a00',
matchOverviewRuler: '#ffcc00',
activeMatchBackground: '#c4580e',
activeMatchBorder: '#ffcf6b',
activeMatchColorOverviewRuler: '#ff9900'
}
}),
[caseSensitive, regex]
)
@ -57,9 +75,9 @@ export default function TerminalSearch({
return
}
if (searchAddon && isOpen) {
searchAddon.findNext(query, { caseSensitive, regex, incremental: true })
searchAddon.findNext(query, searchOptions(true))
}
}, [query, searchAddon, isOpen, caseSensitive, regex, searchStateRef])
}, [query, searchAddon, isOpen, caseSensitive, regex, searchStateRef, searchOptions])
const handleKeyDown = useCallback(
(e: React.KeyboardEvent) => {