@codemirror/search
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -0,1 +1,7 @@ | ||
## 6.2.1 (2022-09-26) | ||
### Bug fixes | ||
By-word search queries will now skip any result that had word characters both before and after a match boundary. | ||
## 6.2.0 (2022-08-25) | ||
@@ -17,3 +23,3 @@ | ||
The `literal` search option can now be set to make literal queries the default. Move out of surrogate pairs when tracking match position in RegExpCursor | ||
The `literal` search option can now be set to make literal queries the default. | ||
@@ -20,0 +26,0 @@ The new `searchPanelOpen` function can be used to find out whether the search panel is open for a given state. |
@@ -251,3 +251,3 @@ import { showPanel, EditorView, getPanel, Decoration, ViewPlugin, runScopeHandlers } from '@codemirror/view'; | ||
this.test = options === null || options === void 0 ? void 0 : options.test; | ||
this.flat = FlattenedDoc.get(text, from, this.chunkEnd(from + 5000 /* Base */)); | ||
this.flat = FlattenedDoc.get(text, from, this.chunkEnd(from + 5000 /* Chunk.Base */)); | ||
} | ||
@@ -632,6 +632,6 @@ chunkEnd(pos) { | ||
} | ||
return categorizer(charAfter(buf, from - bufPos)) != CharCategory.Word || | ||
categorizer(charBefore(buf, to - bufPos)) != CharCategory.Word || | ||
(categorizer(charBefore(buf, from - bufPos)) != CharCategory.Word && | ||
categorizer(charAfter(buf, to - bufPos)) != CharCategory.Word); | ||
return (categorizer(charBefore(buf, from - bufPos)) != CharCategory.Word || | ||
categorizer(charAfter(buf, from - bufPos)) != CharCategory.Word) && | ||
(categorizer(charAfter(buf, to - bufPos)) != CharCategory.Word || | ||
categorizer(charBefore(buf, to - bufPos)) != CharCategory.Word); | ||
}; | ||
@@ -653,3 +653,3 @@ } | ||
for (let pos = to;;) { | ||
let start = Math.max(from, pos - 10000 /* ChunkSize */ - this.spec.unquoted.length); | ||
let start = Math.max(from, pos - 10000 /* FindPrev.ChunkSize */ - this.spec.unquoted.length); | ||
let cursor = stringCursor(this.spec, state, start, pos), range = null; | ||
@@ -662,3 +662,3 @@ while (!cursor.nextOverlapping().done) | ||
return null; | ||
pos -= 10000 /* ChunkSize */; | ||
pos -= 10000 /* FindPrev.ChunkSize */; | ||
} | ||
@@ -700,6 +700,6 @@ } | ||
return (_from, _to, match) => !match[0].length || | ||
categorizer(charAfter(match.input, match.index)) != CharCategory.Word || | ||
categorizer(charBefore(match.input, match.index + match[0].length)) != CharCategory.Word || | ||
(categorizer(charBefore(match.input, match.index)) != CharCategory.Word && | ||
categorizer(charAfter(match.input, match.index + match[0].length)) != CharCategory.Word); | ||
(categorizer(charBefore(match.input, match.index)) != CharCategory.Word || | ||
categorizer(charAfter(match.input, match.index)) != CharCategory.Word) && | ||
(categorizer(charAfter(match.input, match.index + match[0].length)) != CharCategory.Word || | ||
categorizer(charBefore(match.input, match.index + match[0].length)) != CharCategory.Word); | ||
} | ||
@@ -715,3 +715,3 @@ class RegExpQuery extends QueryType { | ||
for (let size = 1;; size++) { | ||
let start = Math.max(from, to - size * 10000 /* ChunkSize */); | ||
let start = Math.max(from, to - size * 10000 /* FindPrev.ChunkSize */); | ||
let cursor = regexpCursor(this.spec, state, start, to), range = null; | ||
@@ -746,3 +746,3 @@ while (!cursor.next().done) | ||
highlight(state, from, to, add) { | ||
let cursor = regexpCursor(this.spec, state, Math.max(0, from - 250 /* HighlightMargin */), Math.min(to + 250 /* HighlightMargin */, state.doc.length)); | ||
let cursor = regexpCursor(this.spec, state, Math.max(0, from - 250 /* RegExp.HighlightMargin */), Math.min(to + 250 /* RegExp.HighlightMargin */, state.doc.length)); | ||
while (!cursor.next().done) | ||
@@ -814,3 +814,3 @@ add(cursor.value.from, cursor.value.to); | ||
let { from, to } = ranges[i]; | ||
while (i < l - 1 && to > ranges[i + 1].from - 2 * 250 /* HighlightMargin */) | ||
while (i < l - 1 && to > ranges[i + 1].from - 2 * 250 /* RegExp.HighlightMargin */) | ||
to = ranges[++i].to; | ||
@@ -817,0 +817,0 @@ query.highlight(view.state, from, to, (from, to) => { |
{ | ||
"name": "@codemirror/search", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "Search functionality for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115691