fastty now has proper unicode character support

This commit is contained in:
Izaya 2017-10-12 16:13:51 +11:00
parent d37cc4a155
commit d8d74fc627
1 changed files with 5 additions and 2 deletions

View File

@ -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})