Skip to content

Commit 28ea475

Browse files
committed
Store window to avoid implicit dependency on blessing/blessed
1 parent e987ad3 commit 28ea475

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bpython/curtsies.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(
6161
self.input_generator = curtsies.input.Input(
6262
keynames="curtsies", sigint_event=True, paste_threshold=None
6363
)
64-
self.window = curtsies.window.CursorAwareWindow(
64+
window = curtsies.window.CursorAwareWindow(
6565
sys.stdout,
6666
sys.stdin,
6767
keep_last_line=True,
@@ -92,6 +92,7 @@ def __init__(
9292

9393
super().__init__(
9494
config,
95+
window,
9596
locals_=locals_,
9697
banner=banner,
9798
interp=interp,

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
)
2525
from .._typing_compat import Literal
2626

27-
import blessings
2827
import greenlet
2928
from curtsies import (
3029
FSArray,
@@ -37,6 +36,7 @@
3736
)
3837
from curtsies.configfile_keynames import keymap as key_dispatch
3938
from curtsies.input import is_main_thread
39+
from curtsies.window import BaseWindow
4040
from cwcwidth import wcswidth
4141
from pygments import format as pygformat
4242
from pygments.formatters import TerminalFormatter
@@ -326,6 +326,7 @@ class BaseRepl(Repl):
326326
def __init__(
327327
self,
328328
config: Config,
329+
window: BaseWindow,
329330
locals_: Optional[Dict[str, Any]] = None,
330331
banner: Optional[str] = None,
331332
interp: Optional[Interp] = None,
@@ -340,6 +341,7 @@ def __init__(
340341
"""
341342

342343
logger.debug("starting init")
344+
self.window = window
343345

344346
# If creating a new interpreter on undo would be unsafe because initial
345347
# state was passed in
@@ -2077,7 +2079,7 @@ def focus_on_subprocess(self, args):
20772079
try:
20782080
signal.signal(signal.SIGWINCH, self.orig_sigwinch_handler)
20792081
with Termmode(self.orig_stdin, self.orig_tcattrs):
2080-
terminal = blessings.Terminal(stream=sys.__stdout__)
2082+
terminal = self.window.t
20812083
with terminal.fullscreen():
20822084
sys.__stdout__.write(terminal.save)
20832085
sys.__stdout__.write(terminal.move(0, 0))

0 commit comments

Comments
 (0)