fix: allow certificate confirm dialog resize

fixes #3371
This commit is contained in:
mathieui 2021-04-17 13:53:04 +02:00
parent 11de2d98b3
commit 116c167e9a
2 changed files with 11 additions and 5 deletions

View file

@ -617,7 +617,7 @@ class Core:
pass pass
sys.__excepthook__(typ, value, trace) 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 """A work-around for ncurses resize stuff, which sucks. Normally, ncurses
catches SIGWINCH itself. In its signal handler, it updates the catches SIGWINCH itself. In its signal handler, it updates the
windows structures (for example the size, etc) and it windows structures (for example the size, etc) and it

View file

@ -10,6 +10,7 @@ import asyncio
import curses import curses
import functools import functools
import select import select
import signal
import ssl import ssl
import sys import sys
import time import time
@ -1463,11 +1464,16 @@ class HandlerCore:
self.core.add_tab(confirm_tab, True) self.core.add_tab(confirm_tab, True)
self.core.doupdate() self.core.doupdate()
# handle resize
prev_value = signal.signal(signal.SIGWINCH, self.core.sigwinch_handler)
while not confirm_tab.done: while not confirm_tab.done:
sel = select.select([sys.stdin], [], [], 5)[0] try:
sel = select.select([sys.stdin], [], [], 0.5)[0]
if sel: if sel:
self.core.on_input_readable() self.core.on_input_readable()
except:
continue
signal.signal(signal.SIGWINCH, prev_value)
def validate_ssl(self, pem): def validate_ssl(self, pem):
""" """