diff options
-rw-r--r-- | poezio/core/core.py | 2 | ||||
-rw-r--r-- | poezio/core/handlers.py | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py index 3ab5c600..2af292f1 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -617,7 +617,7 @@ class Core: pass sys.__excepthook__(typ, value, trace) - def sigwinch_handler(self): + def sigwinch_handler(self, *args): """A work-around for ncurses resize stuff, which sucks. Normally, ncurses catches SIGWINCH itself. In its signal handler, it updates the windows structures (for example the size, etc) and it diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index a8226541..6262a1d5 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -10,6 +10,7 @@ import asyncio import curses import functools import select +import signal import ssl import sys import time @@ -1463,11 +1464,16 @@ class HandlerCore: self.core.add_tab(confirm_tab, True) self.core.doupdate() + # handle resize + prev_value = signal.signal(signal.SIGWINCH, self.core.sigwinch_handler) while not confirm_tab.done: - sel = select.select([sys.stdin], [], [], 5)[0] - - if sel: - self.core.on_input_readable() + try: + sel = select.select([sys.stdin], [], [], 0.5)[0] + if sel: + self.core.on_input_readable() + except: + continue + signal.signal(signal.SIGWINCH, prev_value) def validate_ssl(self, pem): """ |