Permalink
Browse files

clean up CodeMirrorAdapter

  • Loading branch information...
1 parent 0892399 commit 096c13528a44268590d12d7a9c33b4d0ecd8e2a7 @timjb timjb committed Mar 18, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/codemirror-adapter.js
@@ -85,12 +85,12 @@ ot.CodeMirrorAdapter = (function () {
if (posLe(pos, change.from)) { return indexFromPos(pos); }
if (posLe(change.to, pos)) {
return indexFromPos({
- line: pos.line + (change.text.length > 0 ? change.text.length - 1 : 0) - (change.to.line - change.from.line),
+ line: pos.line + change.text.length - 1 - (change.to.line - change.from.line),
ch: (change.to.line < pos.line) ?
pos.ch :
(change.text.length <= 1) ?
pos.ch - (change.to.ch - change.from.ch) + sumLengths(change.text) :
- pos.ch - change.to.ch + (change.text.length > 0 ? last(change.text).length : 0)
+ pos.ch - change.to.ch + last(change.text).length
}) + sumLengths(change.removed) - sumLengths(change.text);
}
if (change.from.line === pos.line) {

0 comments on commit 096c135

Please sign in to comment.