Skip to content

Commit

Permalink
fix: codecov missing coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sekedus committed Nov 29, 2024
1 parent 45851b9 commit cab512d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,6 @@ class Editor {

// Update cursor because tab characters can influence the cursor position.
this.$cursorChange();

// Updates "updateCounter" and "ace_nomatch" in the search box
if (this.searchBox && this.searchBox.active === true)
this.searchBox.find(false, false, true);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/ext/searchbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SearchBox {
this.element = div.firstChild;

this.setSession = this.setSession.bind(this);
this.$onEditorInput = this.onEditorInput.bind(this);

this.$init();
this.setEditor(editor);
Expand All @@ -72,6 +73,11 @@ class SearchBox {
this.$syncOptions(true);
}

// Auto update "updateCounter" and "ace_nomatch"
onEditorInput() {
this.find(false, false, true);
}

/**
* @param {HTMLElement} sb
*/
Expand Down Expand Up @@ -283,6 +289,7 @@ class SearchBox {
this.active = false;
this.setSearchRange(null);
this.editor.off("changeSession", this.setSession);
this.editor.off("input", this.$onEditorInput);

this.element.style.display = "none";
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
Expand All @@ -296,6 +303,7 @@ class SearchBox {
show(value, isReplace) {
this.active = true;
this.editor.on("changeSession", this.setSession);
this.editor.on("input", this.$onEditorInput);
this.element.style.display = "";
this.replaceOption.checked = isReplace;

Expand Down
7 changes: 5 additions & 2 deletions src/search_highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SearchHighlight {
this.setRegexp(regExp);
this.clazz = clazz;
this.type = type;
this.docLen = 0;
}

setRegexp(regExp) {
Expand All @@ -33,14 +34,15 @@ class SearchHighlight {
update(html, markerLayer, session, config) {
if (!this.regExp)
return;
var start = config.firstRow, end = config.lastRow;
var start = config.firstRow;
var end = config.lastRow;
var renderedMarkerRanges = {};
var _search = session.$editor.$search;
var mtSearch = _search.$isMultilineSearch(session.$editor.getLastSearchOptions());

for (var i = start; i <= end; i++) {
var ranges = this.cache[i];
if (ranges == null) {
if (ranges == null || session.getValue().length != this.docLen) {
if (mtSearch) {
ranges = [];
var match = _search.$multiLineForward(session, this.regExp, i, end);
Expand Down Expand Up @@ -74,6 +76,7 @@ class SearchHighlight {
html, rangeToAddMarkerTo, this.clazz, config);
}
}
this.docLen = session.getValue().length;
}
}

Expand Down

0 comments on commit cab512d

Please sign in to comment.