Avoid unnecessary calls to mark_for_codepoint
This commit is contained in:
parent
96c93fa252
commit
ff2e5b3966
@ -206,6 +206,10 @@ def gen_ucd():
|
|||||||
p('default: return 0;')
|
p('default: return 0;')
|
||||||
p('\t} // }}}')
|
p('\t} // }}}')
|
||||||
p('}\n')
|
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():
|
def gen_wcwidth():
|
||||||
|
|||||||
2
kitty/emoji.h
generated
2
kitty/emoji.h
generated
@ -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
|
// see gen-wcwidth.py
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|||||||
@ -368,7 +368,7 @@ static inline ssize_t
|
|||||||
fallback_font(Cell *cell) {
|
fallback_font(Cell *cell) {
|
||||||
bool bold = (cell->attrs >> BOLD_SHIFT) & 1;
|
bool bold = (cell->attrs >> BOLD_SHIFT) & 1;
|
||||||
bool italic = (cell->attrs >> ITALIC_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
|
// 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++) {
|
for (size_t i = 0, j = fonts.first_fallback_font_idx; i < fonts.fallback_fonts_count; i++, j++) {
|
||||||
|
|||||||
@ -316,7 +316,7 @@ draw_combining_char(Screen *self, char_type ch) {
|
|||||||
linebuf_mark_line_dirty(self->linebuf, ypos);
|
linebuf_mark_line_dirty(self->linebuf, ypos);
|
||||||
if (ch == 0xfe0f) { // emoji presentation variation marker makes default text presentation emoji (narrow emoji) into wide emoji
|
if (ch == 0xfe0f) { // emoji presentation variation marker makes default text presentation emoji (narrow emoji) into wide emoji
|
||||||
Cell *cell = self->linebuf->line->cells + xpos;
|
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;
|
cell->attrs = (cell->attrs & !WIDTH_MASK) | 2;
|
||||||
if (xpos == self->columns - 1) move_widened_char(self, cell, xpos, ypos);
|
if (xpos == self->columns - 1) move_widened_char(self, cell, xpos, ypos);
|
||||||
else self->cursor->x++;
|
else self->cursor->x++;
|
||||||
|
|||||||
@ -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
|
// see gen-wcwidth.py
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
#define VS15 1275
|
||||||
|
#define VS16 1276
|
||||||
|
|
||||||
bool is_combining_char(char_type ch);
|
bool is_combining_char(char_type ch);
|
||||||
bool is_ignored_char(char_type ch);
|
bool is_ignored_char(char_type ch);
|
||||||
|
|||||||
2
kitty/wcwidth-std.h
generated
2
kitty/wcwidth-std.h
generated
@ -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
|
// see gen-wcwidth.py
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user