From 1dc83a47cf8f4e2df7d0c6cf9e42e8b0ad0a9e63 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 19 Apr 2018 07:30:36 +0530 Subject: [PATCH] When rendering a private use unicode codepoint and a space as a two cell ligature, set the foreground colors of the space cell to match the colors of the first cell. Works around broken applications like powerline that use different colors for the two cells. Fixes #467 --- kitty/fonts.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kitty/fonts.c b/kitty/fonts.c index 2780f5a05..ef71ebdfe 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -897,6 +897,12 @@ render_line(Line *line) { ssize_t cell_font_idx = font_for_cell(cell); if (is_private_use(cell->ch) && i + 1 < line->xnum && (line->cells[i+1].ch == ' ' || line->cells[i+1].ch == 0) && cell_font_idx != BOX_FONT && cell_font_idx != MISSING_FONT) { // We have a private use char followed by a space char, render it as a two cell ligature. + Cell *space_cell = line->cells + i+1; + // Ensure the space cell uses the foreground colors from the PUA cell + // This is needed because there are stupid applications like + // powerline that use PUA+space with different foreground colors + // for the space and the PUA. See for example: https://github.com/kovidgoyal/kitty/issues/467 + space_cell->fg = cell->fg; space_cell->decoration_fg = cell->decoration_fg; RENDER; render_run(line->cells + i, 2, cell_font_idx, true); run_font_idx = NO_FONT;