File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ def request_refresh(when='now'):
8282 refresh_requests .append (curtsies .events .RefreshRequestEvent (when = when ))
8383
8484 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 ()
8590 while True :
8691 t = time .time ()
8792 refresh_requests .sort (key = lambda r : 0 if r .when == 'now' else r .when )
@@ -91,8 +96,8 @@ def event_or_refresh(timeout=None):
9196 e = reload_requests .pop ()
9297 yield e
9398 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 :
96101 yield e
97102
98103 global repl # global for easy introspection `from bpython.curtsies import repl`
You can’t perform that action at this time.
0 commit comments