From 3df4d06fd663bf19f08343b0d77c20672301b9b2 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 25 Jan 2017 22:53:48 -0500 Subject: make wide emoji configurable --- libvt100 | 2 +- src/config.c | 3 +++ src/config.h | 1 + src/term.c | 2 ++ src/window-xlib.c | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libvt100 b/libvt100 index 32f97d8..6776714 160000 --- a/libvt100 +++ b/libvt100 @@ -1 +1 @@ -Subproject commit 32f97d8385d591ec4026f3fb5a1ab8e34e12a06d +Subproject commit 6776714636f32db0d02a0bdf1a6b0e2696dfd291 diff --git a/src/config.c b/src/config.c index 31c4038..961e27e 100644 --- a/src/config.c +++ b/src/config.c @@ -449,6 +449,9 @@ static void runes_config_set(RunesConfig *config, char *key, char *val) else if (!strcmp(key, "bell_is_urgent")) { config->bell_is_urgent = runes_config_parse_bool(val); } + else if (!strcmp(key, "wide_emoji")) { + config->wide_emoji = runes_config_parse_bool(val); + } else if (!strcmp(key, "bgcolor")) { cairo_pattern_t *newcolor; newcolor = runes_config_parse_color(val); diff --git a/src/config.h b/src/config.h index 7324a10..7d38611 100644 --- a/src/config.h +++ b/src/config.h @@ -27,6 +27,7 @@ struct runes_config { unsigned int bold_is_bright: 1; unsigned int bold_is_bold: 1; unsigned int audible_bell: 1; + unsigned int wide_emoji: 1; }; RunesConfig *runes_config_new(int argc, char *argv[]); diff --git a/src/term.c b/src/term.c index 18bc1ba..2eba18c 100644 --- a/src/term.c +++ b/src/term.c @@ -24,6 +24,8 @@ RunesTerm *runes_term_new( t->scr = vt100_screen_new(t->config->default_rows, t->config->default_cols); vt100_screen_set_scrollback_length(t->scr, t->config->scrollback_length); + vt100_screen_set_wide_emoji(t->scr, t->config->scrollback_length); + runes_window_create_window(t, argc, argv); runes_pty_spawn_subprocess(t, envp, cwd); runes_display_set_context(t, t->w->backend_cr); diff --git a/src/window-xlib.c b/src/window-xlib.c index c12602f..fde8f43 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -1213,7 +1213,7 @@ static int runes_window_is_word_char(RunesTerm *t, int row, int col) } uc = g_utf8_get_char(c->contents); - if (vt100_char_width(uc) == 0) { + if (vt100_char_width(uc, t->config->wide_emoji) == 0) { return 0; } if (g_unichar_isspace(uc)) { -- cgit v1.2.3-54-g00ecf