Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Commit

Permalink
make search term case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
xmcp committed Feb 9, 2020
1 parent 2393d2b commit 3ac560f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Common.js
Expand Up @@ -13,8 +13,8 @@ function escape_regex(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

export function build_highlight_re(txt,split) {
return txt ? new RegExp(`(${txt.split(split).filter((x)=>!!x).map(escape_regex).join('|')})`,'g') : /^$/g;
export function build_highlight_re(txt,split,option='g') {
return txt ? new RegExp(`(${txt.split(split).filter((x)=>!!x).map(escape_regex).join('|')})`,option) : /^$/g;
}

export function ColoredSpan(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/Flows.js
Expand Up @@ -516,7 +516,7 @@ class FlowItemRow extends PureComponent {
['nickname',NICKNAME_RE],
];
if(this.props.search_param)
hl_rules.push(['search',build_highlight_re(this.props.search_param,' ')]);
hl_rules.push(['search',build_highlight_re(this.props.search_param,' ','gi')]);
let parts=split_text(this.state.info.text,hl_rules);

let quote_id=null;
Expand Down

0 comments on commit 3ac560f

Please sign in to comment.