John Smith commited on 2022-295 18:00:28
Showing 1 changed files, with 12 additions and 12 deletions.
Previously, cards containing multiple images would display all images after the first twice each. A restructuring of the prompt display algorithm fixes this, but may introduce new bugs -- further testing is needed.
| ... | ... |
@@ -65,18 +65,18 @@ local function imgify(text, basepath, conf) |
| 65 | 65 |
)) |
| 66 | 66 |
end |
| 67 | 67 |
end |
| 68 |
- local le = 1 |
|
| 69 |
- local s, e, pt, ip = text:find(PATTERN) |
|
| 70 |
- while s do |
|
| 71 |
- io.write(pt) |
|
| 72 |
- DISPIMG(ip, text) |
|
| 73 |
- le = e + 1 |
|
| 74 |
- s, e, pt, ip = text:find(PATTERN, le) |
|
| 75 |
- io.write(pt or "") |
|
| 76 |
- DISPIMG(ip, text) |
|
| 77 |
- end |
|
| 78 |
- if le <= #text then |
|
| 79 |
- io.write(text:sub(le)) |
|
| 68 |
+ local lastend = 1 |
|
| 69 |
+ local mstart, mend, prevtext, imgpath = text:find(PATTERN) |
|
| 70 |
+ io.write(prevtext or "") |
|
| 71 |
+ DISPIMG(imgpath, text) |
|
| 72 |
+ while mstart do |
|
| 73 |
+ lastend = mend + 1 |
|
| 74 |
+ mstart, mend, prevtext, imgpath = text:find(PATTERN, lastend) |
|
| 75 |
+ io.write(prevtext or "") |
|
| 76 |
+ DISPIMG(imgpath, text) |
|
| 77 |
+ end |
|
| 78 |
+ if lastend <= #text then |
|
| 79 |
+ io.write(text:sub(lastend)) |
|
| 80 | 80 |
end |
| 81 | 81 |
end |
| 82 | 82 |
|
| 83 | 83 |