-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix default justification width for non-printable/non-ASCII chars
Reproducer: unset s s='コーンシェル' echo ${#s} typeset -L s typeset -p s echo ${#s} Output: 6 typeset -L 18 s='コーンシェル ' 12 Expected output: 6 typeset -L 12 s=コーンシェル 6 Note that the typeset -L, -R or -Z option-argument values do not represent numbers of characters or bytes. Their purpose is to justify. They count horizontal terminal positions. Double-width characters, like Japanese, occupy two horizontal terminal positions each, instead of one, and ksh takes this into account. Thus, the justification width above is 12 though the string length in characters is 6, becasue each character occupies two terminal positions. Also, control characters have no width and do not count. This is similarly broken. src/cmd/ksh93/sh/name.c: - nv_newattr(): The default justification width was calculated based on strlen(), which counts bytes, not terminal positions. Use a loop with mbchar() and mbwidth() (see ast.h) to calculate the correct default width in terminal positions. Resolves: #189
- Loading branch information
Showing
5 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters