Add an option allowing users to override the width of individual Unicode

codepoints (overriding tmux's default list).
This commit is contained in:
nicm
2025-01-01 15:17:36 +00:00
parent eece41547e
commit e00853ee82
7 changed files with 371 additions and 233 deletions

View File

@ -24,40 +24,6 @@
#include "tmux.h"
static const wchar_t utf8_modifier_table[] = {
0x1F1E6,
0x1F1E7,
0x1F1E8,
0x1F1E9,
0x1F1EA,
0x1F1EB,
0x1F1EC,
0x1F1ED,
0x1F1EE,
0x1F1EF,
0x1F1F0,
0x1F1F1,
0x1F1F2,
0x1F1F3,
0x1F1F4,
0x1F1F5,
0x1F1F6,
0x1F1F7,
0x1F1F8,
0x1F1F9,
0x1F1FA,
0x1F1FB,
0x1F1FC,
0x1F1FD,
0x1F1FE,
0x1F1FF,
0x1F3FB,
0x1F3FC,
0x1F3FD,
0x1F3FE,
0x1F3FF
};
/* Has this got a zero width joiner at the end? */
int
utf8_has_zwj(const struct utf8_data *ud)
@ -93,8 +59,39 @@ utf8_is_modifier(const struct utf8_data *ud)
if (utf8_towc(ud, &wc) != UTF8_DONE)
return (0);
if (!utf8_in_table(wc, utf8_modifier_table,
nitems(utf8_modifier_table)))
return (0);
return (1);
switch (wc) {
case 0x1F1E6:
case 0x1F1E7:
case 0x1F1E8:
case 0x1F1E9:
case 0x1F1EA:
case 0x1F1EB:
case 0x1F1EC:
case 0x1F1ED:
case 0x1F1EE:
case 0x1F1EF:
case 0x1F1F0:
case 0x1F1F1:
case 0x1F1F2:
case 0x1F1F3:
case 0x1F1F4:
case 0x1F1F5:
case 0x1F1F6:
case 0x1F1F7:
case 0x1F1F8:
case 0x1F1F9:
case 0x1F1FA:
case 0x1F1FB:
case 0x1F1FC:
case 0x1F1FD:
case 0x1F1FE:
case 0x1F1FF:
case 0x1F3FB:
case 0x1F3FC:
case 0x1F3FD:
case 0x1F3FE:
case 0x1F3FF:
return (1);
}
return (0);
}