rem: debug("setLineNumberStatus:" + " selectionStart = " + buf.selectionStart + ", selectionEnd = " + buf.selectionEnd + ", textToStart = " + textToStart + ", lastLine = " + linesArray[lineNumber - 1] ); 
add: debug.print("setLineNumberStatus:" + " selectionStart = " + buf.selectionStart + ", selectionEnd = " + buf.selectionEnd  + ", lastLine = " + linesArray[lineNumber - 1] ); 
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    //debug("setLineNumberStatus: buf.selectionStart = " + buf.selectionStart);    if (!document.selection) {        // gecko? is that you?    } else {        // set it up, using IE5+ API        // http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_textrange.asp        //debug("setLineNumberStatus: document.selection = " + document.selection);        if (document.selection){            var range = document.selection.createRange();            var storedRange = range.duplicate();            storedRange.moveToElementText(buf);            storedRange.setEndPoint('EndToEnd', range);            debug("setLineNumberStatus: storedRange.text = '" + storedRange.text + "'");            debug("setLineNumberStatus: storedRange.text.length = " + storedRange.text.length                  + ", range.text.length=" + range.text.length                  + ", buf.value.length = " + buf.value.length);            // set start and end points, ala gecko            buf.selectionStart = storedRange.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.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("setLineNumberStatus: checking ie for split workaround: " + start);        var lastChar = textToStart.substr(start, 1);        debug("setLineNumberStatus: checking ie for split workaround: '" + lastChar + "'");        if (lastChar == "\n") {            lineNumber++;            charPosition = 0;            debug("setLineNumberStatus: corrected lineNumber = " + lineNumber);        }    }    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/499e513a3cc333dbcb784318ca05ad90a90b7c8e/cq.js/clean/cq.js