Skip to content

Commit fe56545

Browse files
committed
fix: drawToken: use simple comparison instead of regex
1 parent a50fc65 commit fe56545

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/mixins/canvas-drawer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ function updateTokensLayer (tokensLayer, firstRow, lastRow, offscreenFirstRow, o
610610

611611
const emptyLineRegexp = /^\s+$/
612612
const oneOrMoreWhiteSpaceRegexp = /\s+/
613-
const whiteSpaceRegexp = /\s/
614613

615614
/**
616615
* Draws a single token on the given context.
@@ -638,7 +637,7 @@ function drawToken (context, text, color, x, y, charWidth, charHeight, ignoreWhi
638637
let chars = 0
639638
for (let j = 0, len = text.length; j < len; j++) {
640639
const char = text[j]
641-
if (whiteSpaceRegexp.test(char)) {
640+
if (char === ' ') {
642641
if (chars > 0) {
643642
context.fillRect(x - (chars * charWidth), y, chars * charWidth, charHeight)
644643
}

0 commit comments

Comments
 (0)