John Smith commited on 2022-301 23:36:38
Showing 1 changed files, with 12 additions and 3 deletions.
* fix bug in suspension feature * document suspension feature more accurately as a toggle * indicate, when toggling, which prompt is being changed
| ... | ... |
@@ -244,7 +244,7 @@ if action == "a" then |
| 244 | 244 |
-- Help |
| 245 | 245 |
elseif action == "h" then |
| 246 | 246 |
io.write(string.format( |
| 247 |
- "Usage: %s ACTION\n\nACTION may be one of\n\t(a)dd card\n\t(h)elp\n\t(l)eech search\n\t(r)eview session\n\t(s)tatistics\n\t(t)erminate (suspend) prompt\n", |
|
| 247 |
+ "Usage: %s ACTION\n\nACTION may be one of\n\t(a)dd card\n\t(h)elp\n\t(l)eech search\n\t(r)eview session\n\t(s)tatistics\n\t(t)oggle suspension of prompt\n", |
|
| 248 | 248 |
arg[0] |
| 249 | 249 |
)) |
| 250 | 250 |
-- Leech search |
| ... | ... |
@@ -383,13 +383,22 @@ elseif action == "t" then |
| 383 | 383 |
if arg[2] then |
| 384 | 384 |
local a, b = arg[2]:match("(%d+):(%d+)")
|
| 385 | 385 |
if a and b then |
| 386 |
- ip = { a, b }
|
|
| 386 |
+ -- a and b are valid numbers because they came from a match |
|
| 387 |
+ ip = { tonumber(a), tonumber(b) }
|
|
| 387 | 388 |
end |
| 388 | 389 |
end |
| 389 | 390 |
if ip then |
| 390 | 391 |
deck = loader.load(deckfname, config) |
| 391 | 392 |
if deck then |
| 392 |
- deck[ip[1]][ip[2]].delay = -deck[ip[1]][ip[2]].delay |
|
| 393 |
+ local sp = deck[ip[1]][ip[2]] |
|
| 394 |
+ local dir |
|
| 395 |
+ if sp.delay < 0 then |
|
| 396 |
+ dir = "Restoring" |
|
| 397 |
+ else |
|
| 398 |
+ dir = "Suspending" |
|
| 399 |
+ end |
|
| 400 |
+ io.write(string.format("%s %s\n", dir, sp))
|
|
| 401 |
+ sp.delay = -sp.delay |
|
| 393 | 402 |
loader.save(deckfname, deck) |
| 394 | 403 |
else |
| 395 | 404 |
io.write("Failed to load deck\n")
|
| 396 | 405 |