Scroll horizontally on the input line for long messages
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
dd4f839fad
commit
e37c43b78d
|
@ -110,7 +110,8 @@ class Squirrel(Hazelnut):
|
||||||
if not self.squinnondation.no_emoji:
|
if not self.squinnondation.no_emoji:
|
||||||
self.refresh_emoji_pad()
|
self.refresh_emoji_pad()
|
||||||
try:
|
try:
|
||||||
key = self.squinnondation.screen.getkey(curses.LINES - 1, 3 + len(self.nickname) + self.input_index)
|
key = self.squinnondation.screen.getkey(curses.LINES - 1,
|
||||||
|
min(3 + len(self.nickname) + self.input_index, curses.COLS - 4))
|
||||||
except curses.error:
|
except curses.error:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -383,9 +384,10 @@ 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), "> ")
|
||||||
msg = self.input_buffer
|
msg = self.input_buffer
|
||||||
if len(msg) + len(self.nickname) + 3 >= curses.COLS:
|
if self.input_index >= curses.COLS - len(self.nickname) - 7:
|
||||||
msg = ""
|
msg = msg[self.input_index - (curses.COLS - len(self.nickname) - 7):self.input_index]
|
||||||
self.input_pad.addstr(0, 3 + len(self.nickname), self.input_buffer)
|
msg = msg[:curses.COLS - len(self.nickname) - 7]
|
||||||
|
self.input_pad.addstr(0, 3 + len(self.nickname), msg)
|
||||||
if not self.squinnondation.no_emoji:
|
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)
|
||||||
|
|
Loading…
Reference in New Issue