From b95c25089f83cc42d3f7c76f02309603d9b4cd4b Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 10 Mar 2024 14:42:31 +0200 Subject: [fix] gnosis-review-cloze: Fix multiple clozes reveal Previous implementation would reveal clozes in the wrong order when using > 3 clozes. --- gnosis.el | 9 +++------ 1 file 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 -- cgit v1.2.3