@@ -228,11 +228,11 @@ export default function(CodeMirror) {
228228 } ) ,
229229
230230 clearGutter : methodOp ( function ( gutterID ) {
231- let cm = this , doc = cm . doc , i = doc . first
231+ let doc = this . doc , i = doc . first
232232 doc . iter ( line => {
233233 if ( line . gutterMarkers && line . gutterMarkers [ gutterID ] ) {
234234 line . gutterMarkers [ gutterID ] = null
235- regLineChange ( cm , i , "gutter" )
235+ regLineChange ( this , i , "gutter" )
236236 if ( isEmpty ( line . gutterMarkers ) ) line . gutterMarkers = null
237237 }
238238 ++ i
@@ -315,10 +315,9 @@ export default function(CodeMirror) {
315315 } ,
316316
317317 moveH : methodOp ( function ( dir , unit ) {
318- let cm = this
319- cm . extendSelectionsBy ( range => {
320- if ( cm . display . shift || cm . doc . extend || range . empty ( ) )
321- return findPosH ( cm . doc , range . head , dir , unit , cm . options . rtlMoveVisually )
318+ this . extendSelectionsBy ( range => {
319+ if ( this . display . shift || this . doc . extend || range . empty ( ) )
320+ return findPosH ( this . doc , range . head , dir , unit , this . options . rtlMoveVisually )
322321 else
323322 return dir < 0 ? range . from ( ) : range . to ( )
324323 } , sel_move )
@@ -350,17 +349,17 @@ export default function(CodeMirror) {
350349 } ,
351350
352351 moveV : methodOp ( function ( dir , unit ) {
353- let cm = this , doc = this . doc , goals = [ ]
354- let collapse = ! cm . display . shift && ! doc . extend && doc . sel . somethingSelected ( )
352+ let doc = this . doc , goals = [ ]
353+ let collapse = ! this . display . shift && ! doc . extend && doc . sel . somethingSelected ( )
355354 doc . extendSelectionsBy ( range => {
356355 if ( collapse )
357356 return dir < 0 ? range . from ( ) : range . to ( )
358- let headPos = cursorCoords ( cm , range . head , "div" )
357+ let headPos = cursorCoords ( this , range . head , "div" )
359358 if ( range . goalColumn != null ) headPos . left = range . goalColumn
360359 goals . push ( headPos . left )
361- let pos = findPosV ( cm , headPos , dir , unit )
360+ let pos = findPosV ( this , headPos , dir , unit )
362361 if ( unit == "page" && range == doc . sel . primary ( ) )
363- addToScrollPos ( cm , null , charCoords ( cm , pos , "div" ) . top - headPos . top )
362+ addToScrollPos ( this , null , charCoords ( this , pos , "div" ) . top - headPos . top )
364363 return pos
365364 } , sel_move )
366365 if ( goals . length ) for ( let i = 0 ; i < doc . sel . ranges . length ; i ++ )
@@ -435,19 +434,18 @@ export default function(CodeMirror) {
435434 } ) ,
436435
437436 setSize : methodOp ( function ( width , height ) {
438- let cm = this
439437 let interpret = val => typeof val == "number" || / ^ \d + $ / . test ( String ( val ) ) ? val + "px" : val
440- if ( width != null ) cm . display . wrapper . style . width = interpret ( width )
441- if ( height != null ) cm . display . wrapper . style . height = interpret ( height )
442- if ( cm . options . lineWrapping ) clearLineMeasurementCache ( this )
443- let lineNo = cm . display . viewFrom
444- cm . doc . iter ( lineNo , cm . display . viewTo , line => {
438+ if ( width != null ) this . display . wrapper . style . width = interpret ( width )
439+ if ( height != null ) this . display . wrapper . style . height = interpret ( height )
440+ if ( this . options . lineWrapping ) clearLineMeasurementCache ( this )
441+ let lineNo = this . display . viewFrom
442+ this . doc . iter ( lineNo , this . display . viewTo , line => {
445443 if ( line . widgets ) for ( let i = 0 ; i < line . widgets . length ; i ++ )
446- if ( line . widgets [ i ] . noHScroll ) { regLineChange ( cm , lineNo , "widget" ) ; break }
444+ if ( line . widgets [ i ] . noHScroll ) { regLineChange ( this , lineNo , "widget" ) ; break }
447445 ++ lineNo
448446 } )
449- cm . curOp . forceUpdate = true
450- signal ( cm , "refresh" , this )
447+ this . curOp . forceUpdate = true
448+ signal ( this , "refresh" , this )
451449 } ) ,
452450
453451 operation : function ( f ) { return runInOp ( this , f ) } ,
0 commit comments