Skip to content

Commit a5f090e

Browse files
background color implemented
--HG-- branch : scroll-frontend
1 parent 6e5633d commit a5f090e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

bpython/scrollfrontend/repl.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from fmtstr.fsarray import FSArray
2222
from fmtstr.fmtstr import fmtstr, FmtStr
2323
from fmtstr.bpythonparse import parse as bpythonparse
24-
from fmtstr.bpythonparse import func_for_letter
24+
from fmtstr.bpythonparse import func_for_letter, color_for_letter
2525

2626
from bpython.scrollfrontend.manual_readline import char_sequences as rl_char_sequences
2727
from bpython.scrollfrontend.manual_readline import get_updated_char_sequences
@@ -41,7 +41,6 @@
4141
#TODO figure out what config.flush_output is
4242
#TODO options.interactive, .quiet
4343
#TODO execute file if in args
44-
#TODO prettier completion box!
4544
#TODO working raw_input
4645

4746
from bpython.keys import cli_key_dispatch as key_dispatch
@@ -107,7 +106,7 @@ class Repl(BpythonRepl):
107106
outputs:
108107
-2D array to be rendered
109108
110-
Repl is mostly view-indepented state of Repl - but self.width and self.height
109+
Repl is mostly view-independent state of Repl - but self.width and self.height
111110
are important for figuring out how to wrap lines for example.
112111
Usually self.width and self.height should be set by receiving a window resize event,
113112
not manually set to anything - as long as the first event received is a window
@@ -514,9 +513,6 @@ def paint(self, about_to_exit=False):
514513
less state is cool!
515514
"""
516515

517-
#TODO allow custom background colors? I'm not sure about this
518-
# use fmtstr.bpythonparse.color_for_letter(config.background) -> "black"
519-
520516
if about_to_exit:
521517
self.clean_up_current_line_for_exit() # exception to not changing state!
522518

@@ -575,6 +571,11 @@ def paint(self, about_to_exit=False):
575571

576572
if show_status_bar and not about_to_exit:
577573
arr[max(arr.height, min_height), :] = paint.paint_statusbar(1, width, self.status_bar.current_line, self.config)
574+
575+
576+
if self.config.color_scheme['background'] not in ('d', 'D'):
577+
for r in range(arr.height):
578+
arr[r] = fmtstr(arr[r], bg=color_for_letter(self.config.color_scheme['background']))
578579
return arr, (cursor_row, cursor_column)
579580

580581
## Debugging shims

0 commit comments

Comments
 (0)