From d3d18c384a5136478b99ffae58de270d06b1fa08 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 30 Jun 2014 14:01:39 +0100 Subject: [PATCH] Fix remote cursors --- .../ide/editor/cursor-position/CursorPositionManager.coffee | 6 ++++++ .../coffee/app/ide/editor/directives/aceEditor.coffee | 6 ------ .../app/ide/editor/highlights/HighlightsManager.coffee | 3 ++- .../coffee/app/ide/online-users/OnlineUsersManager.coffee | 1 + services/web/public/stylesheets/app/editor.less | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/services/web/public/coffee/app/ide/editor/cursor-position/CursorPositionManager.coffee b/services/web/public/coffee/app/ide/editor/cursor-position/CursorPositionManager.coffee index 1c94cc06e6..be90f8fcec 100644 --- a/services/web/public/coffee/app/ide/editor/cursor-position/CursorPositionManager.coffee +++ b/services/web/public/coffee/app/ide/editor/cursor-position/CursorPositionManager.coffee @@ -11,6 +11,12 @@ define [], () -> @gotoStoredPosition() + @editor.on "changeSelection", () => + cursor = @editor.getCursorPosition() + console.log "Updating cursor position", cursor + @$scope.$apply () => + @$scope.cursorPosition = cursor + @$scope.$watch "gotoLine", (value) => console.log "Going to line", value if value? diff --git a/services/web/public/coffee/app/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/app/ide/editor/directives/aceEditor.coffee index 5f5f238a44..d7235ce771 100644 --- a/services/web/public/coffee/app/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/app/ide/editor/directives/aceEditor.coffee @@ -65,12 +65,6 @@ define [ scope.$on event, () -> editor.resize() - editor.on "changeSelection", () -> - cursor = editor.getCursorPosition() - scope.$apply () -> - if scope.cursorPosition? - scope.cursorPosition = cursor - scope.$watch "theme", (value) -> editor.setTheme("ace/theme/#{value}") diff --git a/services/web/public/coffee/app/ide/editor/highlights/HighlightsManager.coffee b/services/web/public/coffee/app/ide/editor/highlights/HighlightsManager.coffee index 6f7f65351e..b1afe3fb57 100644 --- a/services/web/public/coffee/app/ide/editor/highlights/HighlightsManager.coffee +++ b/services/web/public/coffee/app/ide/editor/highlights/HighlightsManager.coffee @@ -37,8 +37,9 @@ define [ do (annotation) => colorScheme = @_getColorScheme(annotation.hue) if annotation.cursor? + console.log "DRAWING CURSOR", annotation @labels.push { - text: annotation.text + text: annotation.label range: new Range( annotation.cursor.row, annotation.cursor.column, annotation.cursor.row, annotation.cursor.column + 1 diff --git a/services/web/public/coffee/app/ide/online-users/OnlineUsersManager.coffee b/services/web/public/coffee/app/ide/online-users/OnlineUsersManager.coffee index 5a908fd336..ef4a343bda 100644 --- a/services/web/public/coffee/app/ide/online-users/OnlineUsersManager.coffee +++ b/services/web/public/coffee/app/ide/online-users/OnlineUsersManager.coffee @@ -38,6 +38,7 @@ define [ UPDATE_INTERVAL: 500 sendCursorPositionUpdate: () -> + console.log "SENDING CURSOR POSITION UPDATE", @$scope.editor.cursorPosition if !@cursorUpdateTimeout? @cursorUpdateTimeout = setTimeout ()=> position = @$scope.editor.cursorPosition diff --git a/services/web/public/stylesheets/app/editor.less b/services/web/public/stylesheets/app/editor.less index c3ad368b4c..185fec5e64 100644 --- a/services/web/public/stylesheets/app/editor.less +++ b/services/web/public/stylesheets/app/editor.less @@ -69,6 +69,7 @@ background-position: bottom left; } .remote-cursor { + position: absolute; border-left: 2px solid transparent; .nubbin { height: 5px;