diff --git a/graphics/elements/rectangle.lua b/graphics/elements/rectangle.lua index 069ef2b..a8c65b1 100644 --- a/graphics/elements/rectangle.lua +++ b/graphics/elements/rectangle.lua @@ -38,7 +38,7 @@ local function rectangle(args) assert(border_width_h * 2 <= e.frame.h, "graphics.elements.rectangle: border too thick for height") -- form the basic and top/bottom blit strings - spaces = util.strrep(" ", e.frame.w) + spaces = util.spaces(e.frame.w) blit_fg = util.strrep(e.fg_bg.blit_fgd, e.frame.w) blit_bg_top_bot = util.strrep(border_blit, e.frame.w) diff --git a/graphics/elements/vbar.lua b/graphics/elements/vbar.lua index 333af74..c140c2e 100644 --- a/graphics/elements/vbar.lua +++ b/graphics/elements/vbar.lua @@ -25,7 +25,7 @@ local function vbar(args) -- blit strings local fgd = util.strrep(e.fg_bg.blit_fgd, e.frame.w) local bkg = util.strrep(e.fg_bg.blit_bkg, e.frame.w) - local spaces = util.strrep(" ", e.frame.w) + local spaces = util.spaces(e.frame.w) local one_third = util.strrep("\x8f", e.frame.w) local two_thirds = util.strrep("\x83", e.frame.w) diff --git a/scada-common/util.lua b/scada-common/util.lua index dea1621..1a36bc0 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -68,6 +68,13 @@ function util.strrep(str, n) return repeated end +-- repeat a space n times +---@param n integer +---@return string +function util.spaces(n) + return util.strrep(" ", n) +end + -- wrap a string into a table of lines, supporting single dash splits ---@param str string ---@param limit integer line limit