code: function(session) {
      this.session = session;
      this.doc = session.getDocument();
  
      this.clearSelection();
      this.selectionLead = this.doc.createAnchor(0, 0);
      this.selectionAnchor = this.doc.createAnchor(0, 0);
  
      var _self = this;
      this.selectionLead.on("change", function(e) {
          _self._emit("changeCursor");
          if (!_self.$isEmpty)
              _self._emit("changeSelection");
          if (!_self.$preventUpdateDesiredColumnOnChange && e.old.column != e.value.column)
              _self.$updateDesiredColumn();
      });
  
      this.selectionAnchor.on("change", function() {
          if (!_self.$isEmpty)
              _self._emit("changeSelection");
      });
  }
docs: Keeps cursor position and the text selection of an edit session.
  
  The row/columns used in the selection are in document coordinates
  representing ths coordinates as thez appear in the document
  before applying soft wrap and folding.