From 736f83d5eefa7344418069826e0d39f4d754c626 Mon Sep 17 00:00:00 2001 From: Allan Crooks Date: Fri, 10 Feb 2023 15:55:09 +0000 Subject: [PATCH] Fix calculation of line height in StaticText. --- src/widget.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/widget.lua b/src/widget.lua index a6f1ab4..d1e6ac8 100644 --- a/src/widget.lua +++ b/src/widget.lua @@ -519,10 +519,13 @@ function StaticText:init(text, args) Text.init(self, args or {}) self._lines = {} - local _, line_count = text:gsub("[^\n]*", function(line) + text = text .. "\n" + + for line in text:gmatch("(.-)\n") do table.insert(self._lines, line) - end) - self.height = line_count * self._line_height + end + + self.height = #self._lines * self._line_height end function StaticText:render_background(cr)