Skip to content

Commit

Permalink
#3680 Only apply the first matched keyword highlight for terminal output
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdong262 committed Dec 8, 2024
1 parent 0c0eeda commit 93dc64e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/components/terminal/highlight-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class KeywordHighlighterAddon {
if (keyword) {
try {
const regex = new RegExp(`(${keyword})`, 'gi')
text = text.replace(regex, this.colorize(color))
if (regex.test(text)) {
return text.replace(regex, this.colorize(color))
}
} catch (e) {
window.store.onError(e)
}
Expand Down

0 comments on commit 93dc64e

Please sign in to comment.