Fix find_widget bugs

This commit is contained in:
SiriusXT
2024-11-12 10:56:54 +08:00
parent d63baa1503
commit a0c6d695b0
3 changed files with 11 additions and 3 deletions

View File

@@ -171,6 +171,10 @@ export default class FindInCode {
codeEditor.focus();
}
async replace(replaceText) {
// this.findResult may be undefined and null
if (!this.findResult || this.findResult.length===0){
return;
}
let currentFound = -1;
this.findResult.forEach((marker, index) => {
const pos = marker.find();
@@ -202,6 +206,9 @@ export default class FindInCode {
}
}
async replaceAll(replaceText) {
if (!this.findResult || this.findResult.length===0){
return;
}
const codeEditor = await this.getCodeEditor();
const doc = codeEditor.doc;
codeEditor.operation(() => {