def refresh(self) -> None:
"""Recalculate and refresh the screen."""
+ self.console.height, self.console.width = self.console.getheightwidth()
# this call sets up self.cxy, so call it first.
self.screen = self.calc_screen()
self.console.refresh(self.screen, self.cxy)
self.__write_code(self._cup, y - self.__offset, x)
def __sigwinch(self, signum, frame):
- self.height, self.width = self.getheightwidth()
self.event_queue.insert(Event("resize", None))
def __hide_cursor(self):
console.get_event.side_effect = events
console.height = 100
console.width = 80
+ console.getheightwidth = MagicMock(side_effect=lambda: (console.height, console.width))
+
for key, val in kwargs.items():
setattr(console, key, val)
return console
console.get_event.side_effect = events
console.height = 100
console.width = 80
+ console.getheightwidth = MagicMock(side_effect=lambda: (console.height, console.width))
console.input_hook = input_hook
return console
events = itertools.chain(code_to_events(code))
reader, console = handle_events_short_unix_console(events)
- console.height = 2
- console.getheightwidth = MagicMock(lambda _: (2, 80))
+ console.getheightwidth = MagicMock(side_effect=lambda: (2, 80))
def same_reader(_):
return reader
events = itertools.chain(code_to_events(code))
reader, console = handle_events_unix_console_height_3(events)
- console.height = 1
- console.getheightwidth = MagicMock(lambda _: (1, 80))
+ console.getheightwidth = MagicMock(side_effect=lambda: (1, 80))
def same_reader(_):
return reader
events = code_to_events(code)
reader, console = self.handle_events_narrow(events)
- console.height = 20
- console.width = 80
- console.getheightwidth = MagicMock(lambda _: (20, 80))
+ console.getheightwidth = MagicMock(side_effect=lambda: (20, 80))
def same_reader(_):
return reader
events = code_to_events(code)
reader, console = self.handle_events(events)
- console.height = 20
- console.width = 4
- console.getheightwidth = MagicMock(lambda _: (20, 4))
+ console.getheightwidth = MagicMock(side_effect=lambda: (20, 4))
def same_reader(_):
return reader
events = itertools.chain(code_to_events(code))
reader, console = self.handle_events_short(events)
- console.height = 2
- console.getheightwidth = MagicMock(lambda _: (2, 80))
+ console.getheightwidth = MagicMock(side_effect=lambda: (2, 80))
def same_reader(_):
return reader
events = itertools.chain(code_to_events(code))
reader, console = self.handle_events_height_3(events)
- console.height = 1
- console.getheightwidth = MagicMock(lambda _: (1, 80))
+ console.getheightwidth = MagicMock(side_effect=lambda: (1, 80))
def same_reader(_):
return reader
--- /dev/null
+Fix incorrect REPL height and width tracking on console window resize on Windows.