Flush standard output when necessary
John Smith

John Smith commited on 2022-103 17:06:47
Showing 1 changed files, with 4 additions and 0 deletions.

... ...
@@ -181,6 +181,7 @@ elseif action == "r" then
181 181
         io.write(string.format(
182 182
             "%d prompts are ready for review.\nHow many to review in this session? ", #ctrt
183 183
         ))
184
+        io.flush()
184 185
         local climt = io.read("l")
185 186
         local climn = tonumber(climt)
186 187
         if climn then
... ...
@@ -205,6 +206,7 @@ elseif action == "r" then
205 206
                     disptime(review.schedule(pr, st, 1)),
206 207
                     disptime(review.schedule(pr, st, 1.5))
207 208
                 ))
209
+                io.flush()
208 210
                 local resp = io.read("l")
209 211
                 local sc = succfromstr(resp)
210 212
                 if sc == -1 then
... ...
@@ -231,6 +233,7 @@ elseif action == "r" then
231 233
                     "\n%d cards queued for editing -- press Enter to proceed",
232 234
                     #editqueue
233 235
                 ))
236
+                io.flush()
234 237
                 io.read("l")
235 238
                 for ind, ci in ipairs(editqueue) do
236 239
                     local pr = deck[ci][1]
... ...
@@ -239,6 +242,7 @@ elseif action == "r" then
239 242
                             "Card #%d:\n%s\nCancel correction / Delete / Edit ",
240 243
                             ci, pr:spt()
241 244
                         ))
245
+                        io.flush()
242 246
                         local resp = io.read("l"):sub(1, 1):lower()
243 247
                         if resp == "d" then
244 248
                             deck[ci][1].deleted = true
245 249