Fix icat kitten

Fixes https://github.com/kovidgoyal/kitty/issues/2081.
This bug was introduced in 10e5fcc37535fdf6eed7f03f1c5380a2b4f0db9c.

One place in the code requires the actual `screen_size_function`, not just the result of it.
This commit is contained in:
Luflosi 2019-10-20 21:37:14 +02:00
parent 7d8edccb04
commit b710ffc403
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362

View File

@ -99,10 +99,15 @@ Do not print out anything to stdout during operation.
screen_size = None screen_size = None
def get_screen_size(): def get_screen_size_function():
global screen_size global screen_size
if screen_size is None: if screen_size is None:
screen_size = screen_size_function() screen_size = screen_size_function()
return screen_size
def get_screen_size():
screen_size = get_screen_size_function()
return screen_size() return screen_size()
@ -323,7 +328,6 @@ def process_single_item(item, args, url_pat=None, maybe_dir=True):
def main(args=sys.argv): def main(args=sys.argv):
global screen_size
args, items = parse_args(args[1:], options_spec, usage, help_text, '{} +kitten icat'.format(appname)) args, items = parse_args(args[1:], options_spec, usage, help_text, '{} +kitten icat'.format(appname))
if args.print_window_size: if args.print_window_size:
@ -343,7 +347,7 @@ def main(args=sys.argv):
sys.stdin.close() sys.stdin.close()
sys.stdin = open(os.ctermid(), 'r') sys.stdin = open(os.ctermid(), 'r')
screen_size = get_screen_size() screen_size = get_screen_size_function()
signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True)) signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True))
if screen_size().width == 0: if screen_size().width == 0:
if args.detect_support: if args.detect_support: