Make message format more configurable around nicks
Normal messages were previously hardcoded to 'nick> ', and /me messages to '* nick ', this commit adds three new theme variables to make these configurable.
This commit is contained in:
parent
69f28e97f3
commit
f6a53e66c7
2 changed files with 10 additions and 7 deletions
|
@ -325,7 +325,9 @@ class Theme:
|
|||
COLOR_COLUMN_HEADER_SEL = (4, 36)
|
||||
|
||||
# Strings for special messages (like join, quit, nick change, etc)
|
||||
# Special messages
|
||||
CHAR_BEFORE_NICK_ME = '* '
|
||||
CHAR_AFTER_NICK_ME = ' '
|
||||
CHAR_AFTER_NICK = '> '
|
||||
CHAR_JOIN = '--->'
|
||||
CHAR_QUIT = '<---'
|
||||
CHAR_KICK = '-!-'
|
||||
|
|
|
@ -178,18 +178,19 @@ def write_pre_message(msg: Message, win: Win, with_timestamps: bool, nick_size:
|
|||
offset += PreMessageHelpers.write_ack(win)
|
||||
else:
|
||||
offset += PreMessageHelpers.write_nack(win)
|
||||
theme = get_theme()
|
||||
if msg.me:
|
||||
with win.colored_text(color=get_theme().COLOR_ME_MESSAGE):
|
||||
win.addstr('* ')
|
||||
with win.colored_text(color=theme.COLOR_ME_MESSAGE):
|
||||
win.addstr(theme.CHAR_BEFORE_NICK_ME)
|
||||
PreMessageHelpers.write_nickname(win, nick, color, msg.highlight)
|
||||
offset += PreMessageHelpers.write_revisions(win, msg)
|
||||
win.addstr(' ')
|
||||
offset += 3
|
||||
win.addstr(theme.CHAR_AFTER_NICK_ME)
|
||||
offset += len(theme.CHAR_BEFORE_NICK_ME) + len(theme.CHAR_AFTER_NICK_ME)
|
||||
else:
|
||||
PreMessageHelpers.write_nickname(win, nick, color, msg.highlight)
|
||||
offset += PreMessageHelpers.write_revisions(win, msg)
|
||||
win.addstr('> ')
|
||||
offset += 2
|
||||
win.addstr(theme.CHAR_AFTER_NICK)
|
||||
offset += len(theme.CHAR_AFTER_NICK)
|
||||
return offset
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue