From ee6337034aae1c5b1330e553227b7d8e39410fc5 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 27 Jul 2015 10:09:31 +0200 Subject: [PATCH] :bug: Fix error raised if some invisibles are undefined Fixes #368 --- lib/mixins/canvas-drawer.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/mixins/canvas-drawer.coffee b/lib/mixins/canvas-drawer.coffee index 71cedffd..bc65db4a 100644 --- a/lib/mixins/canvas-drawer.coffee +++ b/lib/mixins/canvas-drawer.coffee @@ -210,12 +210,13 @@ class CanvasDrawer extends Mixin # line - The screen line for which replacing the invisibles characters. getInvisibleRegExp: (line) -> if line? and line.invisibles? - /// - #{_.escapeRegExp line.invisibles.cr}| - #{_.escapeRegExp line.invisibles.eol}| - #{_.escapeRegExp line.invisibles.space}| - #{_.escapeRegExp line.invisibles.tab} - ///g + invisibles = [] + invisibles.push line.invisibles.cr if line.invisibles.cr? + invisibles.push line.invisibles.eol if line.invisibles.eol? + invisibles.push line.invisibles.space if line.invisibles.space? + invisibles.push line.invisibles.tab if line.invisibles.tab? + + ///#{invisibles.map(_.escapeRegExp).join('|')}///g # Internal: Draws a single token on the given context. #