@@ -2699,10 +2699,23 @@ editorInstance.on('focus', function (cm) {
26992699 window . personalInfo [ 'cursor' ] = editor . getCursor ( )
27002700 socket . emit ( 'cursor focus' , editor . getCursor ( ) )
27012701} )
2702- editorInstance . on ( 'cursorActivity' , function ( cm ) {
2703- updateStatusBar ( )
2704- cursorActivity ( )
2705- } )
2702+
2703+ const cursorActivity = _ . debounce ( cursorActivityInner , cursorActivityDebounce )
2704+
2705+ function cursorActivityInner ( ) {
2706+ if ( editorHasFocus ( ) && ! Visibility . hidden ( ) ) {
2707+ for ( var i = 0 ; i < window . onlineUsers . length ; i ++ ) {
2708+ if ( window . onlineUsers [ i ] . id === window . personalInfo . id ) {
2709+ window . onlineUsers [ i ] . cursor = editor . getCursor ( )
2710+ }
2711+ }
2712+ window . personalInfo [ 'cursor' ] = editor . getCursor ( )
2713+ socket . emit ( 'cursor activity' , editor . getCursor ( ) )
2714+ }
2715+ }
2716+
2717+ editorInstance . on ( 'cursorActivity' , updateStatusBar )
2718+ editorInstance . on ( 'cursorActivity' , cursorActivity )
27062719
27072720editorInstance . on ( 'beforeSelectionChange' , updateStatusBar )
27082721editorInstance . on ( 'beforeSelectionChange' , function ( doc , selections ) {
@@ -2737,19 +2750,6 @@ editorInstance.on('beforeSelectionChange', function (doc, selections) {
27372750 }
27382751} )
27392752
2740- var cursorActivity = _ . debounce ( cursorActivityInner , cursorActivityDebounce )
2741-
2742- function cursorActivityInner ( ) {
2743- if ( editorHasFocus ( ) && ! Visibility . hidden ( ) ) {
2744- for ( var i = 0 ; i < window . onlineUsers . length ; i ++ ) {
2745- if ( window . onlineUsers [ i ] . id === window . personalInfo . id ) {
2746- window . onlineUsers [ i ] . cursor = editor . getCursor ( )
2747- }
2748- }
2749- window . personalInfo [ 'cursor' ] = editor . getCursor ( )
2750- socket . emit ( 'cursor activity' , editor . getCursor ( ) )
2751- }
2752- }
27532753editorInstance . on ( 'blur' , function ( cm ) {
27542754 for ( var i = 0 ; i < window . onlineUsers . length ; i ++ ) {
27552755 if ( window . onlineUsers [ i ] . id === window . personalInfo . id ) {
0 commit comments