For real this time
This commit is contained in:
Simon Cambier
2022-12-12 21:24:33 +01:00
parent 3bdbfe12bf
commit a8199db570
3 changed files with 8 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ import {
} from 'obsidian'
import type { SearchMatch } from '../globals'
import {
chsSegmenter,
getChsSegmenter,
excerptAfter,
excerptBefore,
highlightClass,
@@ -73,7 +73,7 @@ export function stringsToRegex(strings: string[]): RegExp {
if (!strings.length) return /^$/g
// \\b is "word boundary", and is not applied if the user uses the cm-chs-patch plugin
const joined = strings
.map(s => (chsSegmenter ? '' : '\\b') + escapeRegex(s))
.map(s => (getChsSegmenter() ? '' : '\\b') + escapeRegex(s))
.join('|')
const reg = new RegExp(`(${joined})`, 'gi')
// console.log(reg)