termstr: When there are no wide chars to pad don't make a new string
This commit is contained in:
parent
f77d5743a1
commit
284f1ba8cd
1 changed files with 3 additions and 2 deletions
|
|
@ -166,8 +166,9 @@ _ZERO_WIDTH_SPACE = "\u200b"
|
|||
|
||||
|
||||
def _pad_wide_chars(str_):
|
||||
return "".join(f"{char}{_ZERO_WIDTH_SPACE}"
|
||||
if cwcwidth.wcwidth(char) == 2 else char for char in str_)
|
||||
padded_str = "".join(f"{char}{_ZERO_WIDTH_SPACE}"
|
||||
if cwcwidth.wcwidth(char) == 2 else char for char in str_)
|
||||
return str_ if len(padded_str) == len(str_) else padded_str
|
||||
|
||||
|
||||
class TermStr(collections.UserString):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue