ltui icon indicating copy to clipboard operation
ltui copied to clipboard

is there utf8 support?

Open mendisobal opened this issue 5 years ago • 5 comments

Do you plan utf8 support?

mendisobal avatar Jun 21 '20 09:06 mendisobal

I don't have time to support it now.

waruqi avatar Jun 21 '20 09:06 waruqi

In linux I managed to have utf8 running by simply linking to ncursesw. There are some issues with drawing on short views, but it may be simple to solve it with Lua 5.4 or with a library such as https://github.com/starwing/luautf8

image

I will investigate it further when I have the time

laelnasan avatar Dec 04 '20 15:12 laelnasan

In linux I managed to have utf8 running by simply linking to ncursesw.

We also need to consider pdcurse with wchar.

There are some issues with drawing on short views, but it may be simple to solve it with Lua 5.4 or with a library such as https://github.com/starwing/luautf8

I also need to consider the compatibility with xmake, because xmake also uses ltui, https://github.com/xmake-io/xmake/tree/master/xmake/core/ui

But xmake's ltui does not need luautf8, because its runtime rewrites built-in lua modules such as io/string, and has added support for utf8.

I will investigate it further when I have the time

Thanks

waruqi avatar Dec 04 '20 15:12 waruqi

I also need to consider the compatibility with xmake, because xmake also uses ltui, https://github.com/xmake-io/xmake/tree/master/xmake/core/ui

But xmake's ltui does not need luautf8, because its runtime rewrites built-in lua modules such as io/string, and has added support for utf8.

this pr #27 solves the splitting of utf8 strings and also permits utf8 input in textedit views. Both ncurses and pdcurses use codes greater then 0xFF for special key codes, hence the limitation for codes < 0x7f is not strictly needed AFAIK

We also need to consider pdcurse with wchar.

I've submitted a pr #28 with the required flag for pdcurses, but I didn't test it, I got access to a windows machine but didn't set up the environment yet. I tried to use ltui over ssh (putty), though. If the utf8 support comes to be, it would be nice to permit the user to choose utf8 glyphs instead of ACS characters:

image

the utf8 characters and mouse events work fine over ssh. Great for embedded applications!

laelnasan avatar Dec 05 '20 13:12 laelnasan

Thank you very much, as long as you can ensure compatibility with xmake's ui module, only modify curses/pdcurses, or replace some native io interfaces, I welcome pr.

But I don't want to add new c modules and interface calls to ltui. Because when these patches are merged into xmake, these c libraries will also be added.

waruqi avatar Dec 06 '20 07:12 waruqi