Skip to content

Commit 507fc05

Browse files
fix bpython#342 import completion regression
1 parent 7fc33a9 commit 507fc05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bpython/curtsies.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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`

0 commit comments

Comments
 (0)