aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2012-06-24 14:32:07 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2012-06-24 14:32:07 -0400
commit51136aba16a9d070de374627e361a359ec7b9578 (patch)
tree39e26a066af98272eae24489a000eda6928a7289
parent2ec5985f9c645fb53c0c327c1fbd514e68c614a7 (diff)
downloadtextadept-51136aba16a9d070de374627e361a359ec7b9578.tar.gz
textadept-51136aba16a9d070de374627e361a359ec7b9578.zip
Handle UTF-8 characters correctly in ncurses.
-rw-r--r--src/Makefile2
-rw-r--r--src/textadept.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index 3741f461..044300fe 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -128,7 +128,7 @@ endif
ifndef NCURSES
LIBS = $(GTKLIBS)
else
-LIBS = -lncurses -lcdk
+LIBS = -lncursesw -lcdk
endif
TEXTADEPT_OBJS = textadept.o
diff --git a/src/textadept.c b/src/textadept.c
index 624cec61..fdf80595 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1376,7 +1376,7 @@ static int lstring_iconv(lua_State *L) {
const char *to = luaL_checkstring(L, 2), *from = luaL_checkstring(L, 3);
int converted = FALSE;
iconv_t cd = iconv_open(to, from);
- if (cd != (iconv_t) -1) {
+ if (cd != (iconv_t)-1) {
char *out = malloc(text_len + 1), *outp = out;
size_t inbytesleft = text_len, outbytesleft = text_len;
if (iconv(cd, &text, &inbytesleft, &outp, &outbytesleft) != -1)
@@ -2175,6 +2175,7 @@ int main(int argc, char **argv) {
static struct termios oldterm;
tcgetattr(0, &oldterm); // save old terminal settings
TermKey *tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
+ setlocale(LC_CTYPE, ""); // for displaying UTF-8 characters properly
initscr(); // raw()/cbreak() and noecho() are taken care of in libtermkey
curs_set(0); // disable cursor when Scintilla has focus
#endif