Emojize texts
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
b007f4fce5
commit
9835fff1f9
|
@ -0,0 +1 @@
|
|||
emoji~=0.6
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue