mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: add tweak.grapheme-width-method=wcswidth|at-most-2
This commit is contained in:
parent
031e8f5987
commit
9817e44c32
5 changed files with 46 additions and 5 deletions
19
vt.c
19
vt.c
|
|
@ -764,17 +764,26 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
|||
(wanted_count - 2) * sizeof(new_cc->chars[0]));
|
||||
}
|
||||
|
||||
int grapheme_width = composed != NULL ? composed->width : base_width;
|
||||
const int grapheme_width =
|
||||
composed != NULL ? composed->width : base_width;
|
||||
|
||||
if (wc == 0xfe0f)
|
||||
width = 2;
|
||||
new_cc->width = min(max(grapheme_width, width), 2);
|
||||
switch (term->conf->tweak.grapheme_width_method) {
|
||||
case GRAPHEME_WIDTH_MAX_2:
|
||||
if (unlikely(wc == 0xfe0f))
|
||||
width = 2;
|
||||
new_cc->width = min(grapheme_width + width, 2);
|
||||
break;
|
||||
|
||||
case GRAPHEME_WIDTH_WCSWIDTH:
|
||||
new_cc->width = grapheme_width + width;
|
||||
break;
|
||||
}
|
||||
|
||||
term->composed_count++;
|
||||
composed_insert(&term->composed, new_cc);
|
||||
|
||||
wc = CELL_COMB_CHARS_LO + key;
|
||||
width = grapheme_width;
|
||||
width = new_cc->width;
|
||||
|
||||
xassert(wc >= CELL_COMB_CHARS_LO);
|
||||
xassert(wc <= CELL_COMB_CHARS_HI);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue