Skip to content

Commit 7cdc597

Browse files
committed
Move init of cbreak to __enter__ (fixes #174)
Required by blessed.
1 parent febd0e4 commit 7cdc597

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

curtsies/window.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ def __init__(
272272
self._last_cursor_column: Optional[int] = None
273273
self._last_cursor_row: Optional[int] = None
274274
self.keep_last_line = keep_last_line
275-
self.cbreak = (
276-
Cbreak(self.in_stream) if not self._use_blessed else self.t.cbreak()
277-
)
278275
self.extra_bytes_callback = extra_bytes_callback
279276

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

286283
def __enter__(self) -> "CursorAwareWindow":
284+
self.cbreak = (
285+
Cbreak(self.in_stream) if not self._use_blessed else self.t.cbreak()
286+
)
287287
self.cbreak.__enter__()
288288
self.top_usable_row, _ = self.get_cursor_position()
289289
self._orig_top_usable_row = self.top_usable_row

0 commit comments

Comments
 (0)