summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-12-06 16:39:57 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-12-06 16:39:57 +0000
commit87670fb011b638e5bde744a33a047305d17d95c2 (patch)
tree19c135dbff8d825d8eb9fafe69314c29a4097e1c /Src/utils.c
parent5a76a5d34e75219198d012beed06047fd98c7cae (diff)
downloadzsh-87670fb011b638e5bde744a33a047305d17d95c2.tar.gz
zsh-87670fb011b638e5bde744a33a047305d17d95c2.zip
37326: comment only: multibyte string lenght/width counting
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Src/utils.c b/Src/utils.c
index d1313837d..45f8286df 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5179,6 +5179,17 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
ret = mbrtowc(&wc, &inchar, 1, &mb_shiftstate);
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
+ * 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.
+ *
+ * This is in contrast to "num" which counts the characters
+ * or widths in complete characters. The two are summed,
+ * so we don't count characters twice.
+ */
num_in_char++;
} else {
if (ret == MB_INVALID) {