@@ -13,6 +13,10 @@ import CanvasLayer from '../canvas-layer'
1313 * methods are available on any `MinimapElement` instance.
1414 */
1515export default class CanvasDrawer {
16+ constructor ( ) {
17+ // set in setModel of minimapElement
18+ this . minimap = undefined
19+ }
1620 /**
1721 * Initializes the canvas elements needed to perform the `Minimap` rendering.
1822 */
@@ -401,8 +405,8 @@ export default class CanvasDrawer {
401405 * @access private
402406 */
403407 eachTokenForScreenRows ( startRow , endRow , callback ) {
404- const editor = this . getTextEditor ( )
405- const invisibleRegExp = this . getInvisibleRegExp ( )
408+ const editor = this . minimap . getTextEditor ( )
409+ const invisibleRegExp = this . getInvisibleRegExp ( editor )
406410 endRow = Math . min ( endRow , editor . getScreenLineCount ( ) )
407411
408412 for ( let row = startRow ; row < endRow ; row ++ ) {
@@ -471,12 +475,12 @@ export default class CanvasDrawer {
471475 /**
472476 * Returns the regexp to replace invisibles substitution characters
473477 * in editor lines.
474- *
478+ * @param { TextEditor } editor
475479 * @return {RegExp } the regular expression to match invisible characters
476480 * @access private
477481 */
478- getInvisibleRegExp ( ) {
479- const invisibles = this . getTextEditor ( ) . getInvisibles ( )
482+ getInvisibleRegExp ( editor ) {
483+ const invisibles = editor . getInvisibles ( )
480484 const regexp = [ ]
481485 if ( invisibles . cr != null ) { regexp . push ( invisibles . cr ) }
482486 if ( invisibles . eol != null ) { regexp . push ( invisibles . eol ) }
0 commit comments