Skip to content

Commit 0bdab6c

Browse files
committed
fix(editor): search highlighting
1 parent bc7cdfe commit 0bdab6c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/renderer/components/editor/TheEditor.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,16 @@ const setCursorToStartAndClearSelection = () => {
228228
229229
const findAll = (q: string) => {
230230
if (q === '') return
231-
editor.findAll(q, { caseSensitive: false, preventScroll: true })
231+
232+
const prevMarks = editor.session.getMarkers()
233+
234+
if (prevMarks) {
235+
for (const i of Object.keys(prevMarks)) {
236+
editor.session.removeMarker(prevMarks[Number(i)].id)
237+
}
238+
}
239+
240+
editor.findAll(q, { caseSensitive: false, preventScroll: true, range: null })
232241
}
233242
234243
const getCursorPosition = () => {

0 commit comments

Comments
 (0)