Skip to content

Commit 7c1f889

Browse files
checkpoint - window changes are broken
1 parent f8ad90e commit 7c1f889

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

bpython/curtsies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def process_event(e):
7575
term.render_to_terminal(array, cursor_pos)
7676

7777
if paste:
78-
repl.process_event(tc.get_event()) #first event will always be a window size set
78+
repl.process_event(term.get_annotated_event()) #first event will always be a window size set
7979
process_event(paste)
8080

8181
while True:
82-
process_event(tc.get_event(idle=find_iterator))
82+
process_event(term.get_annotated_event(idle=find_iterator))
8383

8484
if __name__ == '__main__':
8585
sys.exit(main())

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ def process_event(self, e):
263263
self.run_code_and_maybe_finish()
264264
elif isinstance(e, events.WindowChangeEvent):
265265
logging.debug('window change to %d %d', e.width, e.height)
266+
#TODO when window gets larger, history is eaten up
267+
self.scroll_offset -= e.cursor_dy
266268
self.width, self.height = e.width, e.height
269+
267270
elif self.status_bar.has_focus:
268271
return self.status_bar.process_event(e)
269272
elif self.stdin.has_focus:
@@ -714,6 +717,7 @@ def _paint(self, about_to_exit=False, user_quit=False):
714717
if show_status_bar:
715718
min_height -= 1
716719

720+
717721
current_line_start_row = len(self.lines_for_display) - max(0, self.scroll_offset)
718722
if self.request_paint_to_clear_screen: # or show_status_bar and about_to_exit ?
719723
self.request_paint_to_clear_screen = False
@@ -726,7 +730,6 @@ def _paint(self, about_to_exit=False, user_quit=False):
726730
#TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
727731

728732
if current_line_start_row < 0: #if current line trying to be drawn off the top of the screen
729-
#assert True, 'no room for current line: contiguity of history broken!'
730733
logging.debug('#<---History contiguity broken by rewind--->')
731734
msg = "#<---History contiguity broken by rewind--->"
732735
arr[0, 0:min(len(msg), width)] = [msg[:width]]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def initialize_options(self):
153153
'pygments'
154154
],
155155
extras_require = {
156-
'curtsies': ['curtsies>=0.0.28', 'greenlet'],
156+
'curtsies': ['curtsies>=0.0.29', 'greenlet'],
157157
'urwid' : ['urwid']
158158
},
159159
tests_require = ['mock'],

0 commit comments

Comments
 (0)