mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:35:40 +00:00
[CMD][SDK][WINSRV] DIR command: Consider double-width characters (#5442)
The "dir /w" command didn't look good due to unaligned columns. - Add sdk/include/reactos/cjkcode.h header file. - Add ConGetTextWidthA/W helper functions. - Add base/shell/cmd/wcwidth.c to implement ConGetTextWidthW. - Use ConGetTextWidth in DirPrintWideList function. - Adjust some STRING_DIR_HELP5, STRING_DIR_HELP6 and STRING_DIR_HELP8 resource strings to make the column aligned. CORE-17591
This commit is contained in:
parent
7b473c1fac
commit
726c46d2da
29 changed files with 493 additions and 113 deletions
47
sdk/include/reactos/cjkcode.h
Normal file
47
sdk/include/reactos/cjkcode.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* PROJECT: ReactOS header
|
||||
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
||||
* PURPOSE: Encoding, charsets and codepages for Chinese, Japanese and Korean (CJK)
|
||||
* COPYRIGHT: Copyright 2017-2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
|
||||
Copyright 2017-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CP_SHIFTJIS 932 // Japanese Shift-JIS
|
||||
#define CP_HANGUL 949 // Korean Hangul/Wansung
|
||||
#define CP_JOHAB 1361 // Korean Johab
|
||||
#define CP_GB2312 936 // Chinese Simplified (GB2312)
|
||||
#define CP_BIG5 950 // Chinese Traditional (Big5)
|
||||
|
||||
/*
|
||||
* "Human-understandable" names for the previous standard code pages.
|
||||
* Taken from https://github.com/microsoft/terminal/blob/main/src/inc/unicode.hpp
|
||||
*/
|
||||
#define CP_JAPANESE CP_SHIFTJIS
|
||||
#define CP_KOREAN CP_HANGUL
|
||||
#define CP_CHINESE_SIMPLIFIED CP_GB2312
|
||||
#define CP_CHINESE_TRADITIONAL CP_BIG5
|
||||
|
||||
/* IsFarEastCP(CodePage) */
|
||||
#define IsCJKCodePage(CodePage) \
|
||||
((CodePage) == CP_SHIFTJIS || (CodePage) == CP_HANGUL || \
|
||||
/* (CodePage) == CP_JOHAB || */ \
|
||||
(CodePage) == CP_BIG5 || (CodePage) == CP_GB2312)
|
||||
|
||||
#if !defined(_WINGDI_) || defined(NOGDI)
|
||||
#define SHIFTJIS_CHARSET 128
|
||||
#define HANGEUL_CHARSET 129
|
||||
#define HANGUL_CHARSET 129 // HANGEUL_CHARSET
|
||||
#if (WINVER >= 0x0400)
|
||||
#define JOHAB_CHARSET 130
|
||||
#endif /* WINVER */
|
||||
#define GB2312_CHARSET 134
|
||||
#define CHINESEBIG5_CHARSET 136
|
||||
#endif /* !defined(_WINGDI_) || defined(NOGDI) */
|
||||
|
||||
/* IsAnyDBCSCharSet(CharSet) */
|
||||
#define IsCJKCharSet(CharSet) \
|
||||
((CharSet) == SHIFTJIS_CHARSET || (CharSet) == HANGUL_CHARSET || \
|
||||
/* (CharSet) == JOHAB_CHARSET || */ \
|
||||
(CharSet) == GB2312_CHARSET || (CharSet) == CHINESEBIG5_CHARSET)
|
Loading…
Add table
Add a link
Reference in a new issue