aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-curses
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface-curses')
-rw-r--r--src/interface-curses/curses-info-popup.c12
-rw-r--r--src/interface-curses/curses-utils.h11
-rw-r--r--src/interface-curses/interface.c12
3 files changed, 27 insertions, 8 deletions
diff --git a/src/interface-curses/curses-info-popup.c b/src/interface-curses/curses-info-popup.c
index 24dee41..e6e1549 100644
--- a/src/interface-curses/curses-info-popup.c
+++ b/src/interface-curses/curses-info-popup.c
@@ -118,14 +118,18 @@ teco_curses_info_popup_init_pad(teco_curses_info_popup_t *ctx, attr_t attr)
switch (entry->type) {
case TECO_POPUP_FILE:
g_assert(!teco_string_contains(&entry->name, '\0'));
- if (teco_ed & TECO_ED_ICONS)
- wprintw(ctx->pad, "%C ", teco_curses_icons_lookup_file(entry->name.data));
+ if (teco_ed & TECO_ED_ICONS) {
+ teco_curses_add_wc(ctx->pad, teco_curses_icons_lookup_file(entry->name.data));
+ waddch(ctx->pad, ' ');
+ }
teco_curses_format_filename(ctx->pad, entry->name.data, -1);
break;
case TECO_POPUP_DIRECTORY:
g_assert(!teco_string_contains(&entry->name, '\0'));
- if (teco_ed & TECO_ED_ICONS)
- wprintw(ctx->pad, "%C ", teco_curses_icons_lookup_dir(entry->name.data));
+ if (teco_ed & TECO_ED_ICONS) {
+ teco_curses_add_wc(ctx->pad, teco_curses_icons_lookup_dir(entry->name.data));
+ waddch(ctx->pad, ' ');
+ }
teco_curses_format_filename(ctx->pad, entry->name.data, -1);
break;
default:
diff --git a/src/interface-curses/curses-utils.h b/src/interface-curses/curses-utils.h
index 28c6f9b..2c819ee 100644
--- a/src/interface-curses/curses-utils.h
+++ b/src/interface-curses/curses-utils.h
@@ -23,3 +23,14 @@
guint teco_curses_format_str(WINDOW *win, const gchar *str, gsize len, gint max_width);
guint teco_curses_format_filename(WINDOW *win, const gchar *filename, gint max_width);
+
+/**
+ * Add Unicode character to window.
+ * This is just like wadd_wch(), but does not require wide-char APIs.
+ */
+static inline void
+teco_curses_add_wc(WINDOW *win, gunichar chr)
+{
+ gchar buf[6];
+ waddnstr(win, buf, g_unichar_to_utf8(chr, buf));
+}
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c
index bf7770d..f4b2796 100644
--- a/src/interface-curses/interface.c
+++ b/src/interface-curses/interface.c
@@ -976,11 +976,14 @@ teco_interface_draw_info(void)
const gchar *info_type_str;
+ waddstr(teco_interface.info_window, PACKAGE_NAME " ");
+
switch (teco_interface.info_type) {
case TECO_INFO_TYPE_QREG:
info_type_str = PACKAGE_NAME " - <QRegister> ";
- wprintw(teco_interface.info_window, "%s %C <QRegister> ", PACKAGE_NAME,
- teco_ed & TECO_ED_ICONS ? TECO_CURSES_ICONS_QREG : '-');
+ teco_curses_add_wc(teco_interface.info_window,
+ teco_ed & TECO_ED_ICONS ? TECO_CURSES_ICONS_QREG : '-');
+ waddstr(teco_interface.info_window, " <QRegister> ");
/* same formatting as in command lines */
teco_curses_format_str(teco_interface.info_window,
teco_interface.info_current.data,
@@ -990,8 +993,9 @@ teco_interface_draw_info(void)
case TECO_INFO_TYPE_BUFFER:
info_type_str = PACKAGE_NAME " - <Buffer> ";
g_assert(!teco_string_contains(&teco_interface.info_current, '\0'));
- wprintw(teco_interface.info_window, "%s %C <Buffer> ", PACKAGE_NAME,
- teco_ed & TECO_ED_ICONS ? teco_curses_icons_lookup_file(teco_interface.info_current.data) : '-');
+ teco_curses_add_wc(teco_interface.info_window,
+ teco_ed & TECO_ED_ICONS ? teco_curses_icons_lookup_file(teco_interface.info_current.data) : '-');
+ waddstr(teco_interface.info_window, " <Buffer> ");
teco_curses_format_filename(teco_interface.info_window,
teco_interface.info_current.data,
getmaxx(teco_interface.info_window) -