From e7063807dda7b2e980eff97c3b3829fdc263d17b Mon Sep 17 00:00:00 2001 From: Trey Blancher Date: Sun, 25 Oct 2020 22:48:20 -0400 Subject: [PATCH] Added left-justifier ('-') as legal format specifier character --- scripts.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts.lua b/scripts.lua index 5fd84c8..5d60e78 100644 --- a/scripts.lua +++ b/scripts.lua @@ -19,7 +19,7 @@ function split_fmt(f) in_spec = false curr = "" elseif string.match(char, '[qs]') then - if string.match(curr, '^%%[0-9]*$') then + if string.match(curr, '^%%%-?[0-9]*$') then curr = curr .. char table.insert(ret, curr) in_spec = false @@ -28,7 +28,7 @@ function split_fmt(f) io.stderr:write("Invalid format: '" .. curr .. char .. "'\n") return nil end - elseif string.match(char, '[0-9%.]') then + elseif string.match(char, '[0-9%.%-]') then curr = curr .. char elseif string.match(char, '%%') then if string.match(curr, '^%%') then @@ -105,7 +105,7 @@ function conky_printf(format, ...) end for i,fs in ipairs(formats) do if is_fmt_spec(fs) then -- we have a format specifier - if string.match(fs, '[dEefgiouXx]$') then -- we have a numeric format specifier, convert value to number + if string.match(fs, '[cdEefgiouXx]$') then -- we have a numeric format specifier, convert value to number parsed_values[i] = tonumber(trim((parsed_values[i]))) end end