Skip to content

Commit daf145c

Browse files
cleaned up about_to_exit hack in curtsies
1 parent 258808a commit daf145c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

bpython/curtsies.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def process_event(e):
4444
try:
4545
repl.process_event(e)
4646
except SystemExitFromCodeThread:
47-
#Get rid of nasty constant
48-
array, cursor_pos = repl.paint(about_to_exit=2)
47+
array, cursor_pos = repl.paint(about_to_exit=True, user_quit=True)
4948
term.render_to_terminal(array, cursor_pos)
5049
raise
5150
except SystemExit:

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def current_output_line(self, value):
627627
self.current_stdouterr_line = ''
628628
self.stdin.current_line = '\n'
629629

630-
def paint(self, about_to_exit=False):
630+
def paint(self, about_to_exit=False, user_quit=False):
631631
"""Returns an array of min_height or more rows and width columns, plus cursor position
632632
633633
Paints the entire screen - ideally the terminal display layer will take a diff and only
@@ -676,7 +676,7 @@ def paint(self, about_to_exit=False):
676676
arr[:history.height,:history.width] = history
677677

678678
current_line = paint.paint_current_line(min_height, width, self.current_cursor_line)
679-
if about_to_exit == 2: # hack for quit() in user code
679+
if user_quit: # quit() or exit() in interp
680680
current_line_start_row = current_line_start_row - current_line.height
681681
logging.debug("---current line row slice %r, %r", current_line_start_row, current_line_start_row + current_line.height)
682682
logging.debug("---current line col slice %r, %r", 0, current_line.width)

0 commit comments

Comments
 (0)