diff --git a/requirements.txt b/requirements.txt index e69de29..8617383 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +emoji~=0.6 diff --git a/squinnondation/squinnondation.py b/squinnondation/squinnondation.py index 1360b49..b5ed331 100644 --- a/squinnondation/squinnondation.py +++ b/squinnondation/squinnondation.py @@ -10,6 +10,8 @@ from ipaddress import IPv6Address from threading import Thread from typing import Any, List, Optional, Tuple +import emoji + from squinnondation.term_manager import TermManager @@ -486,11 +488,14 @@ class Squirrel(Hazelnut): len_after = self.print_markdown(pad, y, x + len_before + len_mid, after, bold, italic, underline, strike) return len_before + len_mid + len_after + # Replace :emoji_name: by the good emoji + msg = emoji.emojize(msg, use_aliases=True) + size = len(msg) + attrs = 0 attrs |= curses.A_BOLD if bold else 0 attrs |= curses.A_ITALIC if italic else 0 attrs |= curses.A_UNDERLINE if underline else 0 - size = len(msg) if strike: msg = "".join(c + "\u0336" for c in msg) pad.addstr(y, x, msg, attrs)