From d8d74fc627b0e3286acaabf9cfd95415e165cff7 Mon Sep 17 00:00:00 2001 From: Izaya Date: Thu, 12 Oct 2017 16:13:51 +1100 Subject: [PATCH] fastty now has proper unicode character support --- modules/drivers/fastty.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/drivers/fastty.lua b/modules/drivers/fastty.lua index 1dc46d1..465d1e5 100644 --- a/modules/drivers/fastty.lua +++ b/modules/drivers/fastty.lua @@ -12,7 +12,9 @@ function tty(gA,sA,sI,mx,my) local function wl(s) s=tostring(s) or "" - for c in s:gmatch(".") do + for i = 1,unicode.len(s) do + local c = "" + c=unicode.sub(s,i,i) if c == "\f" then for i = 1, sy do sb[i] = nil @@ -38,7 +40,7 @@ function tty(gA,sA,sI,mx,my) if sb[cy]:len() > sx then sb[cy] = sb[cy]:sub(1,sx) end - cx=cx+1 + cx=cx+unicode.charWidth(c) end end end @@ -67,6 +69,7 @@ function tty(gA,sA,sI,mx,my) if si == sI then wl(str) rd() + gpu.set(cx,cy,"█") end end end,{sI=sI})