diff options
| author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-12-07 18:54:03 +0000 |
|---|---|---|
| committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-12-07 18:54:03 +0000 |
| commit | 9fb30cf572f7c5ff26e883396a5020da89d9541a (patch) | |
| tree | 849916d8a6e1c2a7a044e15bb6e6fa56f0cb4155 /Src | |
| parent | 37337: Delay freeing widget until not in use. (diff) | |
| download | zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar.gz zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar.bz2 zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar.lz zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar.xz zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.tar.zst zsh-9fb30cf572f7c5ff26e883396a5020da89d9541a.zip | |
37331: Use a single chracter to represent an MB_INCOMPLETE.
This is as it is likely to appear as a single character in output
even if it has multiple octets.
Diffstat (limited to 'Src')
| -rw-r--r-- | Src/utils.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Src/utils.c b/Src/utils.c index 45f8286df..fc2b1920e 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -5180,11 +5180,15 @@ mb_metastrlenend(char *ptr, int width, char *eptr) if (ret == MB_INCOMPLETE) { /* - * "num_in_char" is only used for incomplete characters. The - * assumption is that we will output this ocatet as a single + * "num_in_char" is only used for incomplete characters. + * The assumption is that we will output all trailing octets + * that form part of an incomplete character as a single * character (of single width) if we don't get a complete - * character; if we do get a complete character, num_in_char - * becomes irrelevant and is set to zero. + * character. This is purely pragmatic --- I'm not aware + * of a standard way of dealing with incomplete characters. + * + * If we do get a complete character, num_in_char + * becomes irrelevant and is set to zero * * This is in contrast to "num" which counts the characters * or widths in complete characters. The two are summed, @@ -5216,8 +5220,8 @@ mb_metastrlenend(char *ptr, int width, char *eptr) } } - /* If incomplete, treat remainder as trailing single bytes */ - return num + num_in_char; + /* If incomplete, treat remainder as trailing single character */ + return num + (num_in_char ? 1 : 0); } /* |
