summaryrefslogtreecommitdiff
path: root/org-fc-type-text-input.el
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-01-11 15:24:56 +0100
committerLeon Rische <leon.rische@me.com>2020-01-11 15:24:56 +0100
commit1c7838eb972ac365e648fc231620cb5f18a07788 (patch)
treed0a339cec50b9ecb468f2c7d380e3d3c37e85927 /org-fc-type-text-input.el
Initial commit
Diffstat (limited to 'org-fc-type-text-input.el')
-rw-r--r--org-fc-type-text-input.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/org-fc-type-text-input.el b/org-fc-type-text-input.el
new file mode 100644
index 0000000..3fc923f
--- /dev/null
+++ b/org-fc-type-text-input.el
@@ -0,0 +1,30 @@
+(defun org-fc-type-text-input-init ()
+ (interactive)
+ (org-fc--init-card "text-input")
+ (org-fc-review-data-update '("front")))
+
+(defun org-fc-type-text-input-review (_position)
+ (org-show-subtree)
+ (let ((answer (org-entry-get (point) "ANSWER"))
+ (user-answer (read-string "Answer: ")))
+ (goto-char (point-max))
+ ;; Overlays need to be of at least size 1 to be visible
+ (let ((ovl (make-overlay (- (point) 1) (point))))
+ (overlay-put ovl 'category 'org-fc-additional-text-overlay)
+ (overlay-put ovl 'priority 9999)
+ (overlay-put ovl 'face 'default)
+ (overlay-put ovl 'display
+ (concat "\n\n\nExpected: " answer
+ "\nGot: " user-answer)))))
+
+;; No-op
+(defun org-fc-type-text-input-update ())
+
+;; TODO: Implement real handler
+(org-fc-register-type
+ 'text-input
+ 'org-fc-type-normal-setup
+ 'org-fc-type-normal-flip
+ 'org-fc-type-normal-update)
+
+(provide 'org-fc-type-text-input)