Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finished getting cursor position

  • Loading branch information...
commit 20ecebbcf72914ba6fa520126ca68212df78183f 1 parent 8fef614
@pksunkara authored
Showing with 13 additions and 2 deletions.
  1. +12 −0 public/javascripts/collab.js
  2. +1 −2  views/code.jade
View
12 public/javascripts/collab.js
@@ -20,6 +20,18 @@ sendChat = function() {
e.value = '';
}
+getCursor = function() {
+ cursor = $('.ace_cursor')[0];
+ linem1 = parseInt(cursor.style.top.replace('px',''))/18;
+ column = (parseInt(cursor.style.left.replace('px',''))-4)/7;
+ text = acee.getValue().split("\n");
+ pos = 0;
+ for(i=0;i<linem1;i++) {
+ pos += text[i].length+1;
+ }
+ return pos+column;
+}
+
key_handler = function (key) {
console.log('{'+cpos+','+ver+','+substr+','+e+'}');
socket.emit('text edit', {cursor:cpos, version:ver, substring:substr, edit:e});
View
3  views/code.jade
@@ -18,8 +18,7 @@ script(type='text/javascript')
.row
.span11
pre#editor(style='width:620px;height:500px')
- | var express = require('express'),
- | uid = require('./uid');
+ | var express = require('express');
|
| var app = module.exports = express.createServer();
|
Please sign in to comment.
Something went wrong with that request. Please try again.