Don't display too complex emojis

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2020-12-21 16:04:07 +01:00
parent 90918ddd71
commit 5a212750e6
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 5 additions and 4 deletions

View File

@ -651,7 +651,8 @@ class Squirrel(Hazelnut):
self.emoji_pad.addstr(height - 1, 0, "" + (width - 2) * "" + "")
emojis = list(unicode_codes.UNICODE_EMOJI)
size = (height - 2) * (width - 4) // 4
emojis = [c for c in emojis if len(c) == 1]
size = (height - 2) * (width - 4) // 2
page = emojis[(self.emoji_panel_page - 1) * size:self.emoji_panel_page * size]
if self.emoji_panel_page != 1:
@ -660,10 +661,10 @@ class Squirrel(Hazelnut):
self.emoji_pad.addstr(height - 2, width - 2, "")
for i in range(height - 2):
for j in range((width - 4) // 4):
index = i * (width - 4) // 4 + j
for j in range((width - 4) // 2 + 1):
index = i * (width - 4) // 2 + j
if index < len(page):
self.emoji_pad.addstr(i + 1, 4 * j + 1, page[index])
self.emoji_pad.addstr(i + 1, 2 * j + 1, page[index])
self.emoji_pad.refresh(0, 0, curses.LINES - height - 2, curses.COLS - width - 2,
curses.LINES - 2, curses.COLS - 2)