summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-10 14:42:31 +0200
committerThanos Apollo <[email protected]>2024-03-10 14:44:02 +0200
commitb95c25089f83cc42d3f7c76f02309603d9b4cd4b (patch)
tree3ea754984c4874d8329c63b7a9d992af20875081 /gnosis.el
parentd99b81b165450308a1f2290eb4d0b233fe0967e2 (diff)
[fix] gnosis-review-cloze: Fix multiple clozes reveal
Previous implementation would reveal clozes in the wrong order when using > 3 clozes.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el9
1 files changed, 3 insertions, 6 deletions
diff --git a/gnosis.el b/gnosis.el
index c3cd88b..f9f855e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1136,8 +1136,7 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face."
"Review cloze type note for ID."
(let* ((main (gnosis-get 'main 'notes `(= id ,id)))
(clozes (gnosis-get 'answer 'notes `(= id ,id)))
- (num 1)
- (clozes-num (length clozes))
+ (num 1) ;; Number of clozes revealed
(hint (gnosis-get 'options 'notes `(= id ,id))))
(gnosis-display-cloze-sentence main clozes)
(gnosis-display-image id)
@@ -1150,11 +1149,9 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face."
(setf num (1+ num)))
;; Reveal cloze for wrong input, with `gnosis-face-false'
(gnosis-display-cloze-reveal :replace cloze :success nil)
- ;; Do NOT remove the _when_ statement, unexpected
- ;; bugs occur if so depending on the number of
- ;; clozes.
- (when (< num clozes-num) (gnosis-review-cloze-reveal-unaswered clozes))
(gnosis-display-cloze-user-answer (cdr input))
+ ;; Reveal all clozes left with `gnosis-face-cloze-unanswered' face
+ (gnosis-review-cloze-reveal-unaswered (nthcdr num clozes))
(gnosis-review--update id nil)
(cl-return)))
;; Update note after all clozes are revealed successfully