From 3a6882af54dd4bb5f0fec3567dab2b5b64dec4fe Mon Sep 17 00:00:00 2001 From: Czarnodziej Date: Thu, 25 Mar 2021 16:32:22 +0100 Subject: [PATCH] widget.cal: fix utf-8 weekday names --- widget/cal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widget/cal.lua b/widget/cal.lua index 91f9b47..e7f946f 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -17,6 +17,7 @@ local tconcat = table.concat local type = type local tonumber = tonumber local tostring = tostring +local utf8 = utf8 -- Calendar notification -- lain.widget.cal @@ -52,7 +53,7 @@ local function factory(args) local d = os.date("*t", t) local mth_days, st_day, this_month = d.day, (d.wday-d.day-cal.week_start+1)%7, os.date("%B %Y", t) local notifytable = { [1] = string.format("%s%s\n", string.rep(" ", floor((28 - this_month:len())/2)), markup.bold(this_month)) } - for x = 0,6 do notifytable[#notifytable+1] = os.date("%a", os.time { year=2006, month=1, day=x+cal.week_start }):sub(1, 3) .. " " end + for x = 0,6 do notifytable[#notifytable+1] = os.date("%a", os.time { year=2006, month=1, day=x+cal.week_start }):sub(1, utf8.offset(1, 3)) .. " " end notifytable[#notifytable] = string.format("%s\n%s", notifytable[#notifytable]:sub(1, -2), string.rep(" ", st_day*4)) local strx for x = 1,mth_days do