diff options
author | mathieui <mathieui@mathieui.net> | 2019-09-28 18:35:23 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2020-05-09 19:46:17 +0200 |
commit | 80ce8453f50ccaad4d71fda8811ee33f5ffa3624 (patch) | |
tree | 6e4b7f86f97a82c5fd4cebc6a61349283dee2a36 /poezio/ui/funcs.py | |
parent | a5ef6ec9105f22d14b7d7ec3b634796fc3466e93 (diff) | |
download | poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.gz poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.bz2 poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.tar.xz poezio-80ce8453f50ccaad4d71fda8811ee33f5ffa3624.zip |
Rewrite part of the message handling/rendering
Diffstat (limited to 'poezio/ui/funcs.py')
-rw-r--r-- | poezio/ui/funcs.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/poezio/ui/funcs.py b/poezio/ui/funcs.py index 260cc037..023432ee 100644 --- a/poezio/ui/funcs.py +++ b/poezio/ui/funcs.py @@ -22,12 +22,14 @@ def find_first_format_char(text: str, return pos -def truncate_nick(nick: Optional[str], size=10) -> Optional[str]: +def truncate_nick(nick: Optional[str], size=10) -> str: if size < 1: size = 1 - if nick and len(nick) > size: - return nick[:size] + '…' - return nick + if nick: + if len(nick) > size: + return nick[:size] + '…' + return nick + return '' def parse_attrs(text: str, previous: Optional[List[str]] = None) -> List[str]: |