@@ -17,7 +17,7 @@ export function prepareSelection(cm, primary) {
1717 for ( let i = 0 ; i < doc . sel . ranges . length ; i ++ ) {
1818 if ( primary === false && i == doc . sel . primIndex ) continue
1919 let range = doc . sel . ranges [ i ]
20- if ( range . from ( ) . line >= cm . display . viewTo || range . to ( ) . line < cm . display . viewFrom ) continue
20+ if ( ! cm . options . otherCursors && ( range . from ( ) . line >= cm . display . viewTo || range . to ( ) . line < cm . display . viewFrom ) ) continue
2121 let collapsed = range . empty ( )
2222 if ( collapsed || cm . options . showCursorWhenSelecting )
2323 drawSelectionCursor ( cm , range . head , curFragment )
@@ -44,6 +44,20 @@ export function drawSelectionCursor(cm, head, output) {
4444 otherCursor . style . top = pos . other . top + "px"
4545 otherCursor . style . height = ( pos . other . bottom - pos . other . top ) * .85 + "px"
4646 }
47+
48+ if ( cm . options . otherCursors ) {
49+ var others = cm . display . lineSpace . getElementsByClassName ( 'CodeMirror-other-cursor' ) ;
50+ for ( var i = 0 , l = others . length ; i < l ; i ++ ) {
51+ var other = others [ i ] ;
52+ var line = parseInt ( other . getAttribute ( 'data-line' ) ) ;
53+ var ch = parseInt ( other . getAttribute ( 'data-ch' ) ) ;
54+ var offsetLeft = parseFloat ( other . getAttribute ( 'data-offset-left' ) ) ;
55+ var offsetTop = parseFloat ( other . getAttribute ( 'data-offset-top' ) ) ;
56+ var coord = cm . charCoords ( { line : line , ch : ch } , 'windows' ) ;
57+ other . style . left = coord . left + offsetLeft + 'px' ;
58+ other . style . top = coord . top + offsetTop + 'px' ;
59+ }
60+ }
4761}
4862
4963// Draws the given range as a highlighted selection
0 commit comments