Prevent curses errors
This commit is contained in:
parent
2797b9ddc5
commit
4a79fcaabe
|
@ -715,13 +715,19 @@ class User(Peer):
|
|||
_text_: italic
|
||||
~~text~~: strikethrough
|
||||
"""
|
||||
msg = msg.replace("\0", "")
|
||||
|
||||
# Replace :emoji_name: by the good emoji
|
||||
if not self.squinnondation.no_emoji:
|
||||
import emoji
|
||||
msg = emoji.emojize(msg, use_aliases=True)
|
||||
|
||||
if self.squinnondation.no_markdown:
|
||||
try:
|
||||
pad.addstr(y, x, msg)
|
||||
except curses.error:
|
||||
# Should not happen
|
||||
pass
|
||||
return len(msg)
|
||||
|
||||
underline_match = re.match("(.*)__(.*)__(.*)", msg)
|
||||
|
@ -788,7 +794,11 @@ class User(Peer):
|
|||
space_left_on_line = (curses.COLS - 2) - (x % (curses.COLS - 1))
|
||||
msg = msg[:space_left_on_line + max(0, (curses.COLS - 1) * (remaining_lines - 1))]
|
||||
if msg:
|
||||
try:
|
||||
pad.addstr(y + x // (curses.COLS - 1), x % (curses.COLS - 1), msg, attrs)
|
||||
except curses.error:
|
||||
# Should not happen
|
||||
pass
|
||||
return size
|
||||
|
||||
def refresh_history(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue