Skip to content

Commit 15e7c20

Browse files
committed
Cache a BPythonFormatter on the CLIRepl.
1 parent b2630fc commit 15e7c20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bpython/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def __init__(self, scr, interp, statusbar, config, idle=None):
250250
self.last_key_press = time.time()
251251
self.s = ''
252252
self.statusbar = statusbar
253+
self.formatter = BPythonFormatter(config.color_scheme)
253254

254255
def addstr(self, s):
255256
"""Add a string to the current input line and figure out
@@ -855,8 +856,7 @@ def print_line(self, s, clr=False, newline=False):
855856
self.highlighted_paren = None
856857

857858
if self.config.syntax and (not self.paste_mode or newline):
858-
o = format(self.tokenize(s, newline),
859-
BPythonFormatter(self.config.color_scheme))
859+
o = format(self.tokenize(s, newline), self.formatter)
860860
else:
861861
o = s
862862

0 commit comments

Comments
 (0)