Fix to 1st line charCount & simplifying endPos.ch

If our result is within the first line, add 1 to it to fix offset
No need to have ternary case for replace all, this is now done with a
regex
This commit is contained in:
Matt Pass
2012-10-03 08:03:51 +01:00
parent 79a78e0a58
commit 683752762d

View File

@@ -958,14 +958,15 @@ var ICEcoder = {
}
charCount = ICEcoder.results[ICEcoder.findResult] - numChars - 1;
if (ICEcoder.results[ICEcoder.findResult]<=cM.lineInfo(0).text.length) {
charCount++;
}
startPos = new Object();
startPos.line = lineCount;
startPos.ch = charCount;
endPos = new Object();
endPos.line = lineCount;
document.findAndReplace.connector.value=="and" && document.findAndReplace.replaceAction.value=="replace all" && buttonClick
? endPos.ch = charCount+replaceLen
: endPos.ch = charCount+findLen;
endPos.ch = charCount+findLen;
// Finally, highlight our selection
cM = ICEcoder.getcMInstance();
cM.setSelection(startPos, endPos);