rem: buf.selectionStart = stored_range.text.length - range.text.length; buf.selectionEnd = buf.selectionStart + range.text.length; 
add: buf.selectionStart = storedRange.text.length - range.text.length;  
context: function setLineNumberStatus() {    var lineStatus = document.getElementById(g_cq_textarea_status);    if (lineStatus == null) {        alert("null textarea_status!");        return;    }    var buf = getBuffer();    if (buf == null) {        alert("null buffer!");        return;    }    // must handle this differently for gecko vs IE6    if (buf.selectionStart != null) {        // gecko? is that you?    } else {        // set it up, using IE5+ API        // http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_textrange.asp        if (document.selection){            var range = document.selection.createRange();            var stored_range = range.duplicate();            stored_range.moveToElementText(buf);            stored_range.setEndPoint('EndToEnd', range);            // set start and end points, ala gecko            buf.selectionStart = stored_range.text.length - range.text.length;            buf.selectionEnd = buf.selectionStart + range.text.length;        } else {            alert("setLineNumberStatus: no selectionStart or document.selection!");            return;        }    }    // now we can pretend to be gecko    var start = buf.selectionStart;    // figure out where start is, in the query    var textToStart = buf.value.substring(0, start);    var linesArray = textToStart.split(/\r\n|\r|\n/);    var lineNumber = linesArray.length;    // because of the earlier substring() call,    // the last line ends at selectionStart    var charPosition = linesArray[lineNumber - 1].length;    debug("setLineNumberStatus:"          + " selectionStart = " + buf.selectionStart          + ", selectionEnd = " + buf.selectionEnd          + ", textToStart = " + textToStart          + ", lastLine = " + linesArray[lineNumber - 1]          );    lineStatus.innerHTML = "" + lineNumber + "," + charPosition;}
meta: 952	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/952/081d9c507c7fe8dce4987711db1a59d3e5fff4ef/cq.js/buggy/cq.js