rem: textarea.value.substring(end); 
add: textarea.value.substring(end); 
context:   function encloseSelection(prefix, suffix) {    textarea.focus();    var start, end, sel, scrollPos, subst;    if (typeof(document["selection"]) != "undefined") {      sel = document.selection.createRange().text;    } else if (typeof(textarea["setSelectionRange"]) != "undefined") {      start = textarea.selectionStart;      end = textarea.selectionEnd;      scrollPos = textarea.scrollTop;      sel = textarea.value.substring(start, end);    }    if (sel.match(/ $/)) { // exclude ending space char, if any      sel = sel.substring(0, sel.length - 1);      suffix = suffix + " ";    }    subst = prefix + sel + suffix;    if (typeof(document["selection"]) != "undefined") {      var range = document.selection.createRange().text = subst;      textarea.caretPos -= suffix.length;    } else if (typeof(textarea["setSelectionRange"]) != "undefined") {      textarea.value = textarea.value.substring(0, start) + subst +        textarea.value.substring(end);      if (sel) {        textarea.setSelectionRange(start + subst.length, start + subst.length);      } else {        textarea.setSelectionRange(start + prefix.length, start + prefix.length);      }      textarea.scrollTop = scrollPos;    }  }
meta: 1802	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1802/0f9dc4539faa80ec2d17e2151e28eae36d0b8b40/trac.js/clean/htdocs/trac.js