We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fc33a9 commit 507fc05Copy full SHA for 507fc05
bpython/curtsies.py
@@ -82,6 +82,11 @@ def request_refresh(when='now'):
82
refresh_requests.append(curtsies.events.RefreshRequestEvent(when=when))
83
84
def event_or_refresh(timeout=None):
85
+ if timeout is None:
86
+ timeout = .2
87
+ else:
88
+ timeout = min(.2, timeout)
89
+ starttime = time.time()
90
while True:
91
t = time.time()
92
refresh_requests.sort(key=lambda r: 0 if r.when == 'now' else r.when)
@@ -91,8 +96,8 @@ def event_or_refresh(timeout=None):
96
e = reload_requests.pop()
97
yield e
93
98
else:
94
- e = input_generator.send(.2)
95
- if e is not None:
99
+ e = input_generator.send(timeout)
100
+ if starttime + timeout < time.time() or e is not None:
101
102
103
global repl # global for easy introspection `from bpython.curtsies import repl`
0 commit comments