diff --git a/lib/coder.js b/lib/coder.js index f5323ff..a67d06b 100644 --- a/lib/coder.js +++ b/lib/coder.js @@ -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);