index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Wu Xiaotian <wuxiaotian@loongson.cn> | 2023-09-17 07:08:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-17 09:08:38 +1000 |
commit | 47ed711743f66fd4cabeb270952405674ef985ba (patch) | |
tree | 45001f161781451a40a107469c9a6839c57eed0f /archinstall/lib/menu | |
parent | c9e2027725a75f08cee51e1fe02af93650d9c340 (diff) |
-rw-r--r-- | archinstall/lib/menu/abstract_menu.py | 21 |
diff --git a/archinstall/lib/menu/abstract_menu.py b/archinstall/lib/menu/abstract_menu.py index f12d2b73..306c500a 100644 --- a/archinstall/lib/menu/abstract_menu.py +++ b/archinstall/lib/menu/abstract_menu.py @@ -1,32 +1,15 @@ from __future__ import annotations -import unicodedata from typing import Callable, Any, List, Iterator, Tuple, Optional, Dict, TYPE_CHECKING from .menu import Menu, MenuSelectionType from ..output import error +from ..output import unicode_ljust from ..translationhandler import TranslationHandler, Language if TYPE_CHECKING: _: Any -def count_cjk_chars(string): - "Count the total number of CJK characters contained in a string" - return sum(unicodedata.east_asian_width(c) in 'FW' for c in string) - -def cjkljust(string, width, fillbyte=' '): - """Support left alignment of Chinese, Japanese, Korean text - >>> cjkljust('Hello', 15, '*') - 'Hello**********' - >>> cjkljust('你好', 15, '*') - '你好***********' - >>> cjkljust('안녕하세요', 15, '*') - '안녕하세요*****' - >>> cjkljust('こんにちは', 15, '*') - 'こんにちは*****' - """ - return string.ljust(width - count_cjk_chars(string), fillbyte) - class Selector: def __init__( self, @@ -145,7 +128,7 @@ class Selector: if current: padding += 5 - description = cjkljust(str(self._description), padding, ' ') + description = unicode_ljust(str(self._description), padding, ' ') current = current else: description = self._description |