MCPcopy Create free account
hub / github.com/bpython/bpython / sigwinch_handler

Method sigwinch_handler

bpython/curtsiesfrontend/repl.py:604–618  ·  view source on GitHub ↗
(self, signum: int, frame: FrameType | None)

Source from the content-addressed store, hash-verified

602 return False
603
604 def sigwinch_handler(self, signum: int, frame: FrameType | None) -> None:
605 old_rows, old_columns = self.height, self.width
606 self.height, self.width = self.get_term_hw()
607 cursor_dy = self.get_cursor_vertical_diff()
608 self.scroll_offset -= cursor_dy
609 logger.info(
610 "sigwinch! Changed from %r to %r",
611 (old_rows, old_columns),
612 (self.height, self.width),
613 )
614 logger.info(
615 "decreasing scroll offset by %d to %d",
616 cursor_dy,
617 self.scroll_offset,
618 )
619
620 def sigtstp_handler(self, signum: int, frame: FrameType | None) -> None:
621 self.scroll_offset = len(self.lines_for_display)

Callers

nothing calls this directly

Calls 2

get_term_hwMethod · 0.95

Tested by

no test coverage detected