From 062b0e6188d6ab4ff8fbabc0dc1c09cbfbcaecc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 30 Sep 2017 13:52:28 +0200 Subject: [PATCH] fix messed up bg color encoding --- front-end | 2 +- user/screen.c | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/front-end b/front-end index 673358e..a5a157a 160000 --- a/front-end +++ b/front-end @@ -1 +1 @@ -Subproject commit 673358e2ce64b65b28a4a94079dd83d56a51254a +Subproject commit a5a157ad561879fdb801b81d37a3490d05fd89e3 diff --git a/user/screen.c b/user/screen.c index 617456a..8a6796a 100644 --- a/user/screen.c +++ b/user/screen.c @@ -1936,13 +1936,6 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, int begun_topic = 0; int prev_topic = 0; -#define INC_I() do { \ - i++; \ - if (ss->partial) {\ - if (i%W > ss->x_max) i += (W - ss->x_max + ss->x_min - 1);\ - } \ - } while (0) - #define BEGIN_TOPIC(topic, size) \ if (ss->last_topic == prev_topic) { \ begun_topic = (topic); \ @@ -1964,11 +1957,11 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, bufput_utf8(W); bufput_utf8(termconf_live.theme); - bufput_utf8(termconf_live.default_fg & 0x000FFF); - bufput_utf8((termconf_live.default_fg & 0xFFF000) >> 12); + bufput_utf8(termconf_live.default_fg & 0xFFF); + bufput_utf8((u32)(termconf_live.default_fg >> 16) & 0xFFFF); - bufput_utf8(termconf_live.default_bg & 0x000FFF); - bufput_utf8((termconf_live.default_bg & 0xFFF000) >> 12); + bufput_utf8(termconf_live.default_bg & 0xFFF); + bufput_utf8((u32)(termconf_live.default_bg >> 16) & 0xFFFF); bufput_utf8( (scr.cursor_visible << 0) | @@ -2065,6 +2058,14 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, } } +#define INC_I() do { \ + i++; \ + if (ss->partial) {\ + if (i%W == 0) i += (ss->x_min);\ + else if (i%W > ss->x_max) i += (W - ss->x_max + ss->x_min - 1);\ + } \ + } while (0) + // screen contents int i = ss->index; if (i == ss->i_start) {