Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 8d4dc52

Browse files
author
mattpass
committed
rBlocks are grey, set red after cursor position set
1 parent f80ab91 commit 8d4dc52

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

assets/js/icecoder.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ var ICEcoder = {
28932893

28942894
// Find & replace text according to user selections
28952895
findReplace: function(find, selectNext, canActionChanges, findPrevious) {
2896-
let replace, results, rExp, thisCM, thisSelection, rBlocks, rExpMatch0String, replaceQS, targetQS, filesQS;
2896+
let replace, results, rExp, thisCM, thisSelection, rBlocks, rExpMatch0String, replaceQS, targetQS, filesQS, currRBlock;
28972897

28982898
// Get our replace value and results display
28992899
replace = get('replace').value;
@@ -3006,6 +3006,12 @@ var ICEcoder = {
30063006
this.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks;
30073007
this.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block";
30083008

3009+
// Mark the currRBlock (result for current line) in red
3010+
currRBlock = this.content.contentWindow.document.getElementById('rBlock' + (thisCM.getCursor().line + 1));
3011+
if (currRBlock) {
3012+
currRBlock.style.background = "rgba(192,0,0,0.3)";
3013+
}
3014+
30093015
return true;
30103016

30113017
} else {
@@ -3107,10 +3113,10 @@ var ICEcoder = {
31073113
}
31083114
// If the avg block height for results in results bar is above 0.5 pixels high, we can add a DOM elem
31093115
if (0.5 <= avgBlockH) {
3110-
// Red for current line, grey for another line, transparent if no match
3111-
blockColor = haveMatch ? thisCM.getCursor().line + 1 == i ? "rgba(192,0,0,0.3)" : "rgba(128,128,128,0.3)" : "transparent";
3116+
// Grey for a matching line, transparent if no match
3117+
blockColor = haveMatch ? "rgba(128,128,128,0.3)" : "transparent";
31123118
// Add the DOM elem into our rBlocks string
3113-
rBlocks += '<div style="position: absolute; display: block; width: 12px; height:' + avgBlockH + 'px; background: ' + blockColor + '; top: ' + parseInt((avgBlockH * (i - 1)) + addPadding, 10) + 'px"></div>';
3119+
rBlocks += '<div style="position: absolute; display: block; width: 12px; height:' + avgBlockH + 'px; background: ' + blockColor + '; top: ' + parseInt((avgBlockH * (i - 1)) + addPadding, 10) + 'px" id="rBlock' + i +'"></div>';
31143120
}
31153121
});
31163122

0 commit comments

Comments
 (0)