fix lcurses/hline for ncurses

This commit is contained in:
ruki
2020-05-06 23:18:09 +08:00
parent 056e2d13c6
commit 8690667fac

View File

@@ -86,6 +86,10 @@ Notes:
#include <curses.h> #include <curses.h>
#include <signal.h> #include <signal.h>
#if defined(NCURSES_VERSION)
#include <locale.h>
#endif
#if defined(PDCURSES) && (PDC_BUILD < 3100) #if defined(PDCURSES) && (PDC_BUILD < 3100)
# error Please upgrade to PDCurses 3.1 or later # error Please upgrade to PDCurses 3.1 or later
#endif #endif
@@ -2394,6 +2398,14 @@ __export int luaopen_ltui_lcurses (lua_State *L)
lua_pushcclosure(L, lc_initscr, 1); lua_pushcclosure(L, lc_initscr, 1);
lua_settable(L, -3); lua_settable(L, -3);
/* Since version 5.4, the ncurses library decides how to interpret non-ASCII data using the nl_langinfo function.
* That means that you have to call setlocale() in the application and encode Unicode strings using one of the systems available encodings.
*
* And we need link libncursesw.so for drawing vline, hline characters
*/
#if defined(NCURSES_VERSION)
setlocale(LC_ALL, "");
#endif
return 1; return 1;
} }