Permalink
Browse files

Fixed cursor tracking

  • Loading branch information...
1 parent 76eb971 commit 2ca1452b409481f1d60f06038b14bdc030d36064 @pksunkara committed Sep 18, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 public/javascripts/collab.js
@@ -62,7 +62,6 @@ key_handler = function (event) {
}
}
-
socket.on('edit', function (data){
var text = acee.getSession().getValue();
var currentCursor = getCursor();
@@ -71,15 +70,16 @@ socket.on('edit', function (data){
} else {
text = text.substr(0,data.d.cursor) + data.d.edit + text.substr(data.d.cursor);
}
-
docVersion += 1;
acee.getSession().setValue(text);
-
nickname = localStorage.getItem('nickname');
if(data.n == nickname){
setCursor(data.d.cursor);
} else {
- setCursor(currentCursor);
+ if(data.d.cursor>currentCursor)
+ setCursor(currentCursor-1);
+ else
+ setCursor(currentCursor);
}
});

0 comments on commit 2ca1452

Please sign in to comment.