File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ module.exports = class CanvasDrawer extends Mixin {
5959 */
6060 this . pendingFrontDecorationChanges = [ ]
6161 }
62+
63+ // the maximum number of tokens to render in one line
64+ this . maxTokensInOneLine = atom . config . get ( 'minimap.maxTokensInOneLine' )
6265 }
6366
6467 /**
@@ -416,12 +419,16 @@ module.exports = class CanvasDrawer extends Mixin {
416419 endRow = Math . min ( endRow , editor . getScreenLineCount ( ) )
417420
418421 for ( let row = startRow ; row < endRow ; row ++ ) {
419- editor . tokensForScreenRow ( row ) . forEach ( token => {
422+ const editorTokensForScreenRow = editor . tokensForScreenRow ( row )
423+ const numToken = editorTokensForScreenRow . length
424+ const numTokenToRender = Math . min ( numToken , this . maxTokensInOneLine )
425+ for ( let iToken = 0 ; iToken < numTokenToRender ; iToken ++ ) {
426+ const token = editorTokensForScreenRow [ iToken ]
420427 callback ( row , {
421428 text : token . text . replace ( invisibleRegExp , ' ' ) ,
422429 scopes : token . scopes
423430 } )
424- } )
431+ }
425432 }
426433 }
427434
Original file line number Diff line number Diff line change 194194 "default" : 300 ,
195195 "description" : " The duration of scrolling animations when clicking on the minimap." ,
196196 "order" : 24
197+ },
198+ "maxTokensInOneLine" : {
199+ "type" : " integer" ,
200+ "default" : 160 ,
201+ "description" : " The maximum number of tokens that are rendered for each line." ,
202+ "order" : 25
197203 }
198204 },
199205 "dependencies" : {
You can’t perform that action at this time.
0 commit comments