In no-emoji mode, don't display the emoji menu

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2020-12-21 16:04:08 +01:00
parent 9fcc0c30a7
commit 2630137019
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 34 additions and 30 deletions

View File

@ -65,6 +65,7 @@ class Squinnondation:
squirrel = Squirrel(instance, nickname) squirrel = Squirrel(instance, nickname)
squirrel.refresh_history() squirrel.refresh_history()
squirrel.refresh_input() squirrel.refresh_input()
if not instance.no_emoji:
squirrel.refresh_emoji_pad() squirrel.refresh_emoji_pad()
if instance.args.client_address and instance.args.client_port: if instance.args.client_address and instance.args.client_port:
@ -76,6 +77,7 @@ class Squinnondation:
while True: while True:
squirrel.refresh_history() squirrel.refresh_history()
squirrel.refresh_input() squirrel.refresh_input()
if not instance.no_emoji:
squirrel.refresh_emoji_pad() squirrel.refresh_emoji_pad()
key = screen.getkey(curses.LINES - 1, 3 + len(squirrel.nickname) + squirrel.input_index) key = screen.getkey(curses.LINES - 1, 3 + len(squirrel.nickname) + squirrel.input_index)
if key == "\x7f": # backspace if key == "\x7f": # backspace
@ -115,6 +117,7 @@ class Squinnondation:
except curses.error: except curses.error:
# This is not a valid click # This is not a valid click
continue continue
if not instance.no_emoji:
if y == curses.LINES - 1 and x >= curses.COLS - 3: if y == curses.LINES - 1 and x >= curses.COLS - 3:
# Click on the emoji # Click on the emoji
squirrel.emoji_panel_page *= -1 squirrel.emoji_panel_page *= -1
@ -648,6 +651,7 @@ class Squirrel(Hazelnut):
self.input_pad.addstr(0, 1, self.nickname, curses.A_BOLD | curses.color_pair(color_id + 1)) self.input_pad.addstr(0, 1, self.nickname, curses.A_BOLD | curses.color_pair(color_id + 1))
self.input_pad.addstr(0, 1 + len(self.nickname), "> ") self.input_pad.addstr(0, 1 + len(self.nickname), "> ")
self.input_pad.addstr(0, 3 + len(self.nickname), self.input_buffer) self.input_pad.addstr(0, 3 + len(self.nickname), self.input_buffer)
if not self.squinnondation.no_emoji:
self.input_pad.addstr(0, self.input_pad.getmaxyx()[1] - 3, "😀") self.input_pad.addstr(0, self.input_pad.getmaxyx()[1] - 3, "😀")
self.input_pad.refresh(0, 0, curses.LINES - 1, 0, curses.LINES - 1, curses.COLS - 1) self.input_pad.refresh(0, 0, curses.LINES - 1, 0, curses.LINES - 1, curses.COLS - 1)