Skip to content

Commit 51dfc1c

Browse files
update example embeddable repl demo
1 parent 79ff466 commit 51dfc1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ def _paint(self, about_to_exit=False, user_quit=False):
713713
to worry about that here, instead every frame is completely redrawn because
714714
less state is cool!
715715
"""
716+
# The hairiest function in the curtsies - a cleanup would be great.
716717

717718
if about_to_exit:
718719
self.clean_up_current_line_for_exit() # exception to not changing state!
@@ -825,7 +826,7 @@ def in_paste_mode(self):
825826
yield
826827
self.paste_mode = orig_value
827828

828-
## Debugging shims
829+
## Debugging shims, good example of embedding a Repl in other code
829830
def dumb_print_output(self):
830831
arr, cpos = self.paint()
831832
arr[cpos[0]:cpos[0]+1, cpos[1]:cpos[1]+1] = ['~']
@@ -865,7 +866,7 @@ def r(): raise Exception('errors in other threads should look like this')
865866
t.daemon = True
866867
t.start()
867868
elif c in '$':
868-
c = '[19~'
869+
c = key_dispatch[self.config.pastebin_key][0]
869870
self.process_event(c)
870871

871872
def __repr__(self):
@@ -941,12 +942,11 @@ def simple_repl():
941942
refreshes = []
942943
def request_refresh():
943944
refreshes.append(1)
944-
with Repl(refresh_request=request_refresh) as r:
945+
with Repl(request_refresh=request_refresh) as r:
945946
r.width = 50
946947
r.height = 10
947948
while True:
948-
scrolled = r.dumb_print_output()
949-
r.scroll_offset += scrolled
949+
r.dumb_print_output()
950950
r.dumb_input(refreshes)
951951

952952
if __name__ == '__main__':

0 commit comments

Comments
 (0)