summaryrefslogtreecommitdiff
path: root/poezio/ui/funcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/ui/funcs.py')
-rw-r--r--poezio/ui/funcs.py10
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]: