code: function(text) {
        this.history.commit();
  
        var start = select.cursorPos(this.container, true),
            end = select.cursorPos(this.container, false);
        if (!start || !end) return;
  
        end = this.replaceRange(start, end, text);
        select.setCursorPos(this.container, end);
        webkitLastLineHack(this.container);
      }
docs: Replace the selection with another piece of text.