summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/default_config.cfg4
-rw-r--r--src/windows.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg
index a717fbc2..4188851b 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -71,6 +71,10 @@ completion = normal
# a SPACE will always be added after that
after_completion = ,
+# The maximum length of the nickname that will be displayed in the
+# conversation window.
+max_nick_length = 25
+
# a list of words (separated by a colon (:)) that will be
# highlighted if said by someone on a room
highlight_on =
diff --git a/src/windows.py b/src/windows.py
index 542c027d..b8d276f0 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -47,7 +47,10 @@ g_lock = RLock()
LINES_NB_LIMIT = 4096
-def truncate_nick(nick, size=25):
+def truncate_nick(nick, size=None):
+ size = size or config.get('max_nick_length', 25)
+ if size < 1:
+ size = 1
if nick and len(nick) >= size:
return nick[:size]+'…'
return nick