tboox / ltui

🍖 A cross-platform terminal ui library based on Lua
https://tboox.org
Apache License 2.0
808 stars 49 forks source link

add PDC_WIDE #30

Closed laelnasan closed 3 years ago

laelnasan commented 3 years ago

It should be enough to make pdcurses support utf8, but lacks testing


waruqi commented 3 years ago

I have tested it, I works on win10, but dose not work on win7.

In addition, the text display is not complete on win10.

win7

Snip20201207_29

win10

Snip20201207_30

laelnasan commented 3 years ago

It seems like the win7 is not rendering properly, should be the lacking of fonts? There is one emoji printed properly, hence the cmd does receive the correct text...

laelnasan commented 3 years ago

have you tried https://stackoverflow.com/questions/388490/how-to-use-unicode-characters-in-windows-command-line/388500#388500 ?

laelnasan commented 3 years ago

I'm having a hard time trying to set up the dev environment in win7, perhaps you could land me a hand?

waruqi commented 3 years ago

I'm having a hard time trying to set up the dev environment in win7, perhaps you could land me a hand?

Ok, will do.

laelnasan commented 3 years ago

Ok, will do.

I'm trying to set up xmake in win7, but only documentation I found is for PowerShell. I tried to follow it but no success

waruqi commented 3 years ago

have you tried https://stackoverflow.com/questions/388490/how-to-use-unicode-characters-in-windows-command-line/388500#388500 ?

I tried chcp 65001

Snip20201207_31

waruqi commented 3 years ago

I'm trying to set up xmake in win7, but only documentation I found is for PowerShell. I tried to follow it but no success

You can download xmake installder to install it from https://github.com/xmake-io/xmake/releases

xmake-v2.3.9.win64.exe

waruqi commented 3 years ago

Is it because I did not install the Chinese language pack, which caused some fonts to be missing?

laelnasan commented 3 years ago

You can download xmake installder to install it from https://github.com/xmake-io/xmake/releases

xmake-v2.3.9.win64.exe

Thanks!

Is it because I did not install the Chinese language pack, which caused some fonts to be missing?

it does seems like there are fonts missing...

waruqi commented 3 years ago

it does seems like there are fonts missing...

ok, I think as long as the corresponding font is installed, it should be able to work. We can focus on testing and improving support on win10 first.

laelnasan commented 3 years ago

ok, I think as long as the corresponding font is installed, it should be able to work. We can focus on testing and improving support on win10 first.

Did the behaviour change at all? I'm concerned that the Lua byte for utf8 types are < 0 on windows, that would mess with wcwidth()

waruqi commented 3 years ago

Did the behaviour change at all? I'm concerned that the Lua byte for utf8 types are < 0 on windows, that would mess with wcwidth()

You can set LTUI_LOGFILE=c:\log.txt env and use log:print to show utf8 byte on windows.

laelnasan commented 3 years ago

unfortunately it seems like pdcurses doesn't render wide characters properly https://github.com/wmcbrine/PDCurses/issues/87 it can be poorly solved by printing extra spaces in front of fullwidth characters: image

but I encountered some further issues with input that I have no idea how to solve. I've found a modified version of pdcurses that seems to solve those issues https://github.com/Bill-Gray/PDCursesMod . I don't have the time to look too much into it right now, though.

waruqi commented 3 years ago

Ok, thanks!