Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clean up CodeMirrorAdapter

  • Loading branch information...
commit 096c13528a44268590d12d7a9c33b4d0ecd8e2a7 1 parent 0892399
@timjb timjb authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/codemirror-adapter.js
View
4 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) {
Please sign in to comment.
Something went wrong with that request. Please try again.