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'):
82
82
refresh_requests .append (curtsies .events .RefreshRequestEvent (when = when ))
83
83
84
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 ()
85
90
while True :
86
91
t = time .time ()
87
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):
91
96
e = reload_requests .pop ()
92
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 :
96
101
yield e
97
102
98
103
global repl # global for easy introspection `from bpython.curtsies import repl`
You can’t perform that action at this time.
0 commit comments