From 5a212750e63dd85d44894ff52ff5b22f2e2a6997 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 21 Dec 2020 16:04:07 +0100 Subject: [PATCH] Don't display too complex emojis Signed-off-by: Yohann D'ANELLO --- squinnondation/squinnondation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/squinnondation/squinnondation.py b/squinnondation/squinnondation.py index fff1dc7..369f6f3 100644 --- a/squinnondation/squinnondation.py +++ b/squinnondation/squinnondation.py @@ -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)