mirror of
https://github.com/stablyai/orca
synced 2026-04-21 14:17:16 +00:00
fix(terminal-search): make Cmd+F match highlights high-contrast (#756)
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
This commit is contained in:
parent
c57c55b9b8
commit
3918e4cfcf
1 changed files with 21 additions and 3 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue