code: function editEnd(from, to) {
      if (!to) return 0;
      if (!from) return to.length;
      for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
        if (from.charAt(i) != to.charAt(j)) break;
      return j + 1;
    }
docs: Used to position the cursor after an undo/redo by finding the last edited character.