diff --git a/gen-wcwidth.py b/gen-wcwidth.py index 3acf3960f..dd86cc761 100755 --- a/gen-wcwidth.py +++ b/gen-wcwidth.py @@ -206,6 +206,10 @@ def gen_ucd(): p('default: return 0;') p('\t} // }}}') p('}\n') + if rmap[0xfe0e] != 1275: + raise ValueError('The mark for 0xfe0e has changed, you have to update VS15 to {} and VS16 to {} in unicode-data.h'.format( + rmap[0xfe0e], rmap[0xfe0f] + )) def gen_wcwidth(): diff --git a/kitty/emoji.h b/kitty/emoji.h index 9f396039e..981146c10 100644 --- a/kitty/emoji.h +++ b/kitty/emoji.h @@ -1,4 +1,4 @@ -// unicode data, built from the unicode standard on: 2018-02-05 +// unicode data, built from the unicode standard on: 2018-02-06 // see gen-wcwidth.py #pragma once #include "data-types.h" diff --git a/kitty/fonts.c b/kitty/fonts.c index 4c770b8ad..74d5eb75c 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -368,7 +368,7 @@ static inline ssize_t fallback_font(Cell *cell) { bool bold = (cell->attrs >> BOLD_SHIFT) & 1; bool italic = (cell->attrs >> ITALIC_SHIFT) & 1; - bool emoji_presentation = (cell->attrs & WIDTH_MASK) == 2 && is_emoji(cell->ch) && cell->cc_idx[0] != mark_for_codepoint(0xfe0e); + bool emoji_presentation = (cell->attrs & WIDTH_MASK) == 2 && is_emoji(cell->ch) && cell->cc_idx[0] != VS15; // Check if one of the existing fallback fonts has this text for (size_t i = 0, j = fonts.first_fallback_font_idx; i < fonts.fallback_fonts_count; i++, j++) { diff --git a/kitty/screen.c b/kitty/screen.c index 7d9aafe43..51c147d61 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -316,7 +316,7 @@ draw_combining_char(Screen *self, char_type ch) { linebuf_mark_line_dirty(self->linebuf, ypos); if (ch == 0xfe0f) { // emoji presentation variation marker makes default text presentation emoji (narrow emoji) into wide emoji Cell *cell = self->linebuf->line->cells + xpos; - if ((cell->attrs & WIDTH_MASK) != 2 && cell->cc_idx[0] == mark_for_codepoint(0xfe0f) && is_emoji_presentation_base(cell->ch)) { + if ((cell->attrs & WIDTH_MASK) != 2 && cell->cc_idx[0] == VS16 && is_emoji_presentation_base(cell->ch)) { cell->attrs = (cell->attrs & !WIDTH_MASK) | 2; if (xpos == self->columns - 1) move_widened_char(self, cell, xpos, ypos); else self->cursor->x++; diff --git a/kitty/unicode-data.c b/kitty/unicode-data.c index ef6b5dd0e..e1dcd2d84 100644 --- a/kitty/unicode-data.c +++ b/kitty/unicode-data.c @@ -1,4 +1,4 @@ -// unicode data, built from the unicode standard on: 2018-02-05 +// unicode data, built from the unicode standard on: 2018-02-06 // see gen-wcwidth.py #include "data-types.h" diff --git a/kitty/unicode-data.h b/kitty/unicode-data.h index f21da69d9..fc6af2d2b 100644 --- a/kitty/unicode-data.h +++ b/kitty/unicode-data.h @@ -1,5 +1,7 @@ #pragma once #include "data-types.h" +#define VS15 1275 +#define VS16 1276 bool is_combining_char(char_type ch); bool is_ignored_char(char_type ch); diff --git a/kitty/wcwidth-std.h b/kitty/wcwidth-std.h index 5ce0829ec..279ba8294 100644 --- a/kitty/wcwidth-std.h +++ b/kitty/wcwidth-std.h @@ -1,4 +1,4 @@ -// unicode data, built from the unicode standard on: 2018-02-05 +// unicode data, built from the unicode standard on: 2018-02-06 // see gen-wcwidth.py #pragma once #include "data-types.h"