commit 1476e78f7baedcf9c28c013093ca488371edae88
parent dde594bc40c0cf98d6767a8ccd38f831396e16ab
Author: hhvn <dev@hhvn.uk>
Date: Tue, 26 Oct 2021 20:55:16 +0100
ui.c Makefile: use ncursesw for utf-8
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -9,7 +9,7 @@ LDTLS = -ltls
CTLS = -DTLS
CFLAGS = -g -O0 $(CTLS)
-LDFLAGS = -lncurses $(LDTLS)
+LDFLAGS = -lncursesw $(LDTLS)
$(BIN): $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ)
diff --git a/ui.c b/ui.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
+#include <locale.h>
#include <ncurses.h>
#ifdef TLS
#include <tls.h>
@@ -62,6 +63,7 @@ ui_tls_error_(char *file, int line, struct tls *ctx, char *str) {
void
ui_init(void) {
+ setlocale(LC_ALL, "");
initscr();
raw();
noecho();
@@ -289,7 +291,7 @@ ui_draw_winlist(void) {
else if (sp->status != ConnStatus_connected)
wattron(windows[Win_winlist].window, A_DIM);
- len = wprintw(windows[Win_winlist].window, "%02d: %c- %s\n", i++, sp->next ? '|' : '`', sp->name);
+ len = wprintw(windows[Win_winlist].window, "%02d: %s─ %s\n", i++, sp->next ? "├" : "└", sp->name);
wattroff(windows[Win_winlist].window, A_BOLD);
wattroff(windows[Win_winlist].window, A_DIM);
@@ -299,8 +301,8 @@ ui_draw_winlist(void) {
else if (chp->old)
wattron(windows[Win_winlist].window, A_DIM);
- len = wprintw(windows[Win_winlist].window, "%02d: %c %c- %s\n", i++,
- sp->next ? '|' : ' ', chp->next ? '|' : '`', chp->name);
+ len = wprintw(windows[Win_winlist].window, "%02d: %s %s─ %s\n", i++,
+ sp->next ? "│" : " ", chp->next ? "├" : "└", chp->name);
wattroff(windows[Win_winlist].window, A_BOLD);
wattroff(windows[Win_winlist].window, A_DIM);
}