rem:   debug.print("no selection information: setting 1,0"); lineStatus.innerHTML = "" + 1 + "," + 0; return; 
add: debug.print("setLineNumberStatus: start = 0"); 
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    // must test non-gecko first, since this code will persist    if (document.selection) {        // set it up, using IE5+ API        // http://msdn.microsoft.com/workshop/author/dhtml/reference        //   /objects/obj_textrange.asp        debug.print("setLineNumberStatus: found document.selection");        if (document.selection){            var range = document.selection.createRange();            var storedRange = range.duplicate();            storedRange.moveToElementText(buf);            storedRange.setEndPoint('EndToEnd', range);            debug.print("setLineNumberStatus: storedRange.text = '"                        + storedRange.text + "'"                        + " (" + storedRange.text.length                        + "," + range.text.length                        + "," + buf.value.length                        + ")");            // set start and end points, ala gecko            buf.selectionStart = storedRange.text.length - range.text.length;        } else {            alert("setLineNumberStatus: no document.selection!");            return;        }    } else if (buf.selectionStart) {        // looks like it's gecko    } else {        // TODO khtml, webcore support (probably cannot do it yet)        // may also be 1,0 so set that location and return        debug.print("no selection information: setting 1,0");        lineStatus.innerHTML = "" + 1 + "," + 0;        return;    }    // now we can pretend to be gecko    var start = buf.selectionStart;    // figure out where start is, in the query    var textToStart = buf.value.substr(0, start);    var linesArray = textToStart.split(/\r\n|\r|\n/);    var lineNumber = linesArray.length;    // because of the earlier substr() call,    // the last line ends at selectionStart    var charPosition = linesArray[lineNumber - 1].length;    // TODO: at the start of a line, firefox returns an empty string    // meanwhile, IE6 swallows the whitespace...    // seems to be in the selection-range API, not in split(),    // so this workaround doesn't work!    if (false && is.ie) {        var start = textToStart.length - 1;        debug.print("setLineNumberStatus: checking ie for split workaround: "                    + start);        var lastChar = textToStart.substr(start, 1);        debug.print("setLineNumberStatus: checking ie for split workaround: '"                    + lastChar + "'");        if (lastChar == "\n") {            lineNumber++;            charPosition = 0;            debug.print("setLineNumberStatus: corrected lineNumber = "                        + lineNumber);        }    }    debug.print("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/4a2633599ca5757bb9f9b09e8a112efe67781fe2/cq.js/buggy/cq.js