diff --git a/doc/man/man1/notcurses-demo.1.md b/doc/man/man1/notcurses-demo.1.md index a0e9f9177..7f12be36e 100644 --- a/doc/man/man1/notcurses-demo.1.md +++ b/doc/man/man1/notcurses-demo.1.md @@ -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 diff --git a/src/demo/demo.c b/src/demo/demo.c index 854a70e47..1a54d6cb4 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -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 diff --git a/src/lib/egcpool.h b/src/lib/egcpool.h index 2232b8630..b2bc85844 100644 --- a/src/lib/egcpool.h +++ b/src/lib/egcpool.h @@ -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; diff --git a/src/tests/cell.cpp b/src/tests/cell.cpp index 381c1e7c3..ad45fe445 100644 --- a/src/tests/cell.cpp +++ b/src/tests/cell.cpp @@ -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") {