rem:  var stripWS = BX_selection.anchorNode.data.substring(0,BX_selection.anchorOffset).replace(/^[\t\n\r\s]*$/,"").replace(/[\t\n\r\s]{2,}$/," "); BX_selection.collapse(BX_selection.anchorNode,stripWS.length); 
add: if (BX_selection.anchorNode.nodeType != 3) {  var walker = document.createTreeWalker(document,NodeFilter.SHOW_TEXT, { acceptNode : function(node) { if ((/^[\t\n\r\s]*$/.test(node.nodeValue))) return NodeFilter.FILTER_REJECT; return NodeFilter.FILTER_ACCEPT; } } ,null); BX_selection.anchorNode.normalize(); walker.currentNode = BX_selection.anchorNode;   if (BX_selection.anchorNode.hasChildNodes()) { var nextNode = walker.nextNode(); } else { var nextNode = walker.prevNode(); }  var stripWS = nextNode.data.replace(/^[\t\n\r\s]*$/,"").replace(/[\t\n\r\s]{2,}$/," "); BX_selection.collapse(nextNode,stripWS.length);  } else { var stripWS = BX_selection.anchorNode.data.substring(0,BX_selection.anchorOffset).replace(/^[\t\n\r\s]*$/,"").replace(/[\t\n\r\s]{2,}$/," "); BX_selection.collapse(BX_selection.anchorNode,stripWS.length); } 
context: function BX_cursor_moveLeft () {    // for some strange reasons, we can't emulate LEFT,RIGHT,UP,DOWN....    /*   var ev = document.createEvent("KeyEvents");    ev.initKeyEvent("keypress",true,true,null,false,false,false,false,ev.DOM_VK_LEFT,0);    document.dispatchEvent(ev);    */    BX_selection = window.getSelection();    var stripWS = BX_selection.anchorNode.data.substring(0,BX_selection.anchorOffset).replace(/^[\t\n\r\s]*$/,"").replace(/[\t\n\r\s]{2,}$/," ");    BX_selection.collapse(BX_selection.anchorNode,stripWS.length);    // if we are at the beginning of a node, search nextNode..    if (BX_selection.anchorOffset == 0 ) {        var walker = document.createTreeWalker(document,NodeFilter.SHOW_TEXT,                                               {                                           acceptNode : function(node) {                                                       if ((/^[\t\n\r\s]*$/.test(node.nodeValue)))                                                           return NodeFilter.FILTER_REJECT;                                                       return NodeFilter.FILTER_ACCEPT;                                                   }                                               }                                               ,null);        walker.currentNode = BX_selection.anchorNode;        var nextNode = walker.previousNode();        if (nextNode) {            var stripWS = nextNode.data.replace(/^[\t\n\r\s]*$/,"").replace(/[\t\n\r\s]{2,}$/," ");            BX_selection.collapse(nextNode,stripWS.length-1)        }    } else {        BX_selection.collapse(BX_selection.anchorNode, BX_selection.anchorOffset - 1 );    }}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/ddc240ced5875d7129300fbe7ba664b285e93a9a/bitfluxeditor_core.js/buggy/src/webapp/lenya/resources/misc/bitflux/bxe/js/bitfluxeditor_core.js