Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move new variables to parameters
  • Loading branch information
thomasballinger committed Aug 5, 2016
commit 66c5771711b8b4707b820ed513df293d08b679cc
17 changes: 10 additions & 7 deletions bpython/curtsiesfrontend/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,14 +1251,20 @@ def current_output_line(self, value):
self.current_stdouterr_line = ''
self.stdin.current_line = '\n'

def paint(self, about_to_exit=False, user_quit=False):
def paint(self, about_to_exit=False, user_quit=False,
try_preserve_history_height=40,
min_infobox_height=4):
"""Returns an array of min_height or more rows and width columns, plus
cursor position

Paints the entire screen - ideally the terminal display layer will take
a diff and only write to the screen in portions that have changed, but
the idea is that we don't need to worry about that here, instead every
frame is completely redrawn because less state is cool!

try_preserve_history_height is the the number of rows of content that
must be visible before the suggestion box scrolls the terminal in order
to display more than min_infobox_height rows of suggestions, docs etc.
"""
# The hairiest function in the curtsies
if about_to_exit:
Expand Down Expand Up @@ -1412,15 +1418,12 @@ def move_screen_up(current_line_start_row):
else:
# Logic for determining size of completion box
# smallest allowed over-full completion box
minimum_possible_height = 4
# smallest amount of history that must be visible
try_preserve_history_height = 40
preferred_height = max(
# always make infobox at least this height
minimum_possible_height,
min_infobox_height,

# there's so much space that we can preserve
# this much history and still expand the infobox
# use this value if there's so much space that we can
# preserve this try_preserve_history_height rows history
min_height - try_preserve_history_height)

info_max_rows = min(max(visible_space_below,
Expand Down