mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
force zero-width-joins #2016
This commit is contained in:
parent
cb74709cb0
commit
6f0830c29a
@ -74,7 +74,7 @@ terminal, and will refuse to run in anything smaller than 80x24.
|
||||
**-V**|**--version**: Print the program name and version, and exit with success.
|
||||
|
||||
***demospec***: Select which demos to run, and what order to run them in. The
|
||||
default is **ixetunchdmbkywgarvlsfjqzo**. See above for a list of demos.
|
||||
default is **ixetunchmdbkywgarvlsfjqzo**. See above for a list of demos.
|
||||
|
||||
Default margins are all 0, and thus the full screen will be rendered. Using
|
||||
**-m**, margins can be supplied. Provide a single number to set all four margins
|
||||
|
@ -21,7 +21,7 @@ static int democount;
|
||||
static demoresult* results;
|
||||
static char *datadir = NOTCURSES_SHARE;
|
||||
|
||||
static const char DEFAULT_DEMO[] = "ixetunchdmbkywgarvlsfjqzo";
|
||||
static const char DEFAULT_DEMO[] = "ixetunchmdbkywgarvlsfjqzo";
|
||||
|
||||
atomic_bool interrupted = ATOMIC_VAR_INIT(false);
|
||||
// checked following demos, whether aborted, failed, or otherwise
|
||||
|
@ -97,6 +97,7 @@ utf8_egc_len(const char* gcluster, int* colcount){
|
||||
mbstate_t mbt;
|
||||
memset(&mbt, 0, sizeof(mbt));
|
||||
wchar_t wc, prevw = 0;
|
||||
bool injoin = false;
|
||||
do{
|
||||
r = mbrtowc(&wc, gcluster, MB_CUR_MAX, &mbt);
|
||||
if(r < 0){
|
||||
@ -104,7 +105,7 @@ utf8_egc_len(const char* gcluster, int* colcount){
|
||||
logerror("Invalid UTF8: %s\n", gcluster);
|
||||
return -1;
|
||||
}
|
||||
if(prevw && uc_is_grapheme_break(prevw, wc)){
|
||||
if(prevw && !injoin && uc_is_grapheme_break(prevw, wc)){
|
||||
break; // starts a new EGC, exit and do not claim
|
||||
}
|
||||
int cols = wcwidth(wc);
|
||||
@ -115,6 +116,7 @@ utf8_egc_len(const char* gcluster, int* colcount){
|
||||
logerror("Prohibited or invalid Unicode: 0x%x\n", wc);
|
||||
return -1;
|
||||
}
|
||||
injoin = (wc == L'\u200d');
|
||||
*colcount += cols;
|
||||
ret += r;
|
||||
gcluster += r;
|
||||
|
@ -41,6 +41,11 @@ TEST_CASE("Cell") {
|
||||
WARN(1 == nccell_cols(&c));
|
||||
CHECK(9 == nccell_load(n_, &c, "นี้"));
|
||||
WARN(1 == nccell_cols(&c));
|
||||
|
||||
// type-3 woman playing water polo, 17 bytes (5 characters)
|
||||
CHECK(17 == nccell_load(n_, &c, "\U0001f93d\U0001f3fc\u200d\u2640\ufe0f"));
|
||||
WARN(2 == nccell_cols(&c));
|
||||
nccell_release(n_, &c);
|
||||
}
|
||||
|
||||
SUBCASE("Loadchar") {
|
||||
|
Loading…
Reference in New Issue
Block a user