mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
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.
This commit is contained in:
parent
0c2d823a79
commit
9fb30cf572
2 changed files with 15 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2015-12-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 37331: Src/utils.c: use a single character to represent an
|
||||
MB_INCOMPLETE string even if multiple octets.
|
||||
|
||||
2015-12-07 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 37337: Src/Zle/zle.h, Src/Zle/zle_main.c,
|
||||
|
|
16
Src/utils.c
16
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue