Skip to content

Commit

Permalink
Move init of cbreak to __enter__ (fixes #174)
Browse files Browse the repository at this point in the history
Required by blessed.
  • Loading branch information
sebastinas committed Oct 5, 2022
1 parent febd0e4 commit 7cdc597
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions curtsies/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,6 @@ def __init__(
self._last_cursor_column: Optional[int] = None
self._last_cursor_row: Optional[int] = None
self.keep_last_line = keep_last_line
self.cbreak = (
Cbreak(self.in_stream) if not self._use_blessed else self.t.cbreak()
)
self.extra_bytes_callback = extra_bytes_callback

# whether another SIGWINCH is queued up
Expand All @@ -284,6 +281,9 @@ def __init__(
self.in_get_cursor_diff = False

def __enter__(self) -> "CursorAwareWindow":
self.cbreak = (
Cbreak(self.in_stream) if not self._use_blessed else self.t.cbreak()
)
self.cbreak.__enter__()
self.top_usable_row, _ = self.get_cursor_position()
self._orig_top_usable_row = self.top_usable_row
Expand Down

0 comments on commit 7cdc597

Please sign in to comment.