Skip to content

Commit

Permalink
Make match description update on value change (Fixes #82)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebCoder49 committed Feb 18, 2024
1 parent 8ee4670 commit c6455d4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions plugins/find-and-replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ codeInput.plugins.FindAndReplace = class extends codeInput.Plugin {
if(!codeInput.pluginData.findAndReplace.dialog.classList.contains("code-input_find-and-replace_hidden-dialog")) {
// Code updated and dialog open - re-highlight find matches
codeInput.pluginData.findAndReplace.dialog.findMatchState.rehighlightMatches();
this.updateMatchDescription(codeInput.pluginData.findAndReplace.dialog);

if(codeInput.pluginData.findAndReplace.dialog.findMatchState.numMatches == 0) {
// No more matches after editing
Expand Down Expand Up @@ -429,15 +430,7 @@ codeInput.plugins.FindAndReplace.FindMatchState = class {

/* Highlight all currently found matches again if there are any matches */
rehighlightMatches() {
if(this.codeInput.value != this.lastValue) {
this.updateMatches(this.lastSearchRegexp);
} else {
if(this.matchStartIndexes.length > 0) {
for(let i = 0; i < this.matchStartIndexes.length; i++) {
this.highlightMatch(i, this.codeInput.codeElement, this.matchStartIndexes[i], this.matchEndIndexes[i]);
}
}
}
this.updateMatches(this.lastSearchRegexp);
this.focusMatch();
}

Expand Down

0 comments on commit c6455d4

Please sign in to comment.