From 3658bf26f45eade5e432949e3d0a97ab4b56a6bb Mon Sep 17 00:00:00 2001 From: Brett Terpstra Date: Mon, 4 Dec 2023 10:45:55 -0600 Subject: [PATCH] fix for taskpaper metadata - FIXED: TaskPaper file with metadata causing negative argument error --- lib/mdless/string.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mdless/string.rb b/lib/mdless/string.rb index 68bf6fa..233caf6 100644 --- a/lib/mdless/string.rb +++ b/lib/mdless/string.rb @@ -77,8 +77,8 @@ def color_meta(cols) line = "#{color('metadata color')}#{line}
" end - line += "\u00A0" * (longest - line.uncolor.strip.length) + xc - line + line += "\u00A0" * (longest - line.uncolor.strip.length) if (longest - line.uncolor.strip.length).positive? + line + xc end.join("\n") + "#{xc}\n" end end @@ -93,8 +93,8 @@ def color_meta(cols) longest = longest < @cols ? longest + 1 : @cols lines.map do |line| line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2') - line = "#{color('metadata color')}#{line}
" - line += "\u00A0" * (longest - line.uncolor.strip.length) + line = "#{color('metadata color')}#{line}" + line += "\u00A0" * (longest - line.uncolor.strip.length) if (longest - line.uncolor.strip.length).positive? line + xc end.join("\n") + "#{"\u00A0" * longest}#{xc}\n" end