diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-27 01:11:35 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-27 01:11:35 -0500 |
| commit | 1f362535a109939081a9a65a4601add87afc052d (patch) | |
| tree | c7f8b70acda4b97b165ecbc7a28fbb01c4b45c12 /tests/test-org-drill-entry-text-limit.el | |
| parent | 7eece407772d7c5cfba93ba914439094f0d9fbf2 (diff) | |
| download | org-drill-1f362535a109939081a9a65a4601add87afc052d.tar.gz org-drill-1f362535a109939081a9a65a4601add87afc052d.zip | |
feat: undo last rating, customizable keys, and configurable text limit
A batch of self-contained user-facing improvements, squashed from the feat/org-drill-solo-features branch.
I added an undo for the last rating (issue #2 follow-up). The rating prompt now takes an undo key (org-drill--undo-key, default u): it restores the previous card's scheduling snapshot, drops the recorded quality, and re-queues that card, then returns to the current prompt. Each rating snapshots the scheduling properties and SCHEDULED line onto a per-session stack capped at org-drill-undo-limit (default 3). org-drill-reschedule loops on the rating read so undo doesn't rate the current card.
I made the five session-control keys (quit, edit, help, skip, tags) defcustoms so they can be rebound from customize-group (issue #35), keeping their defaults. The 0-5 rating keys stay as-is, since they're tied to the quality scale rather than being variables.
I lifted the hardcoded 100-line entry-text limit in org-drill-get-entry-text into the org-drill-entry-text-max-lines defcustom, defaulting to 100.
I also deleted a commented-out old org-entry-empty-p that the real definition had already replaced.
Existing tests stay green and each change added its own, including snapshot/restore and prompt-loop tests for undo.
Diffstat (limited to 'tests/test-org-drill-entry-text-limit.el')
| -rw-r--r-- | tests/test-org-drill-entry-text-limit.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test-org-drill-entry-text-limit.el b/tests/test-org-drill-entry-text-limit.el new file mode 100644 index 0000000..c9466cc --- /dev/null +++ b/tests/test-org-drill-entry-text-limit.el @@ -0,0 +1,34 @@ +;;; test-org-drill-entry-text-limit.el --- Tests for the entry-text line limit -*- lexical-binding: t; -*- + +;;; Commentary: +;; org-drill-get-entry-text asks org-agenda for at most N lines of an entry's +;; text. That limit used to be a hardcoded 100; it is now the defcustom +;; org-drill-entry-text-max-lines so a user with very long cards can raise it. + +;;; Code: + +(require 'ert) +(require 'cl-lib) +(require 'org-drill) + +(ert-deftest test-org-drill-entry-text-max-lines-defaults-to-100 () + "The limit keeps its historical default of 100 lines." + (should (eq 100 (default-value 'org-drill-entry-text-max-lines)))) + +(ert-deftest test-org-drill-get-entry-text-uses-the-custom-limit () + "get-entry-text passes the defcustom value as the line limit, not a +hardcoded number." + (let ((org-drill-entry-text-max-lines 7) + (captured nil)) + (cl-letf (((symbol-function 'org-agenda-get-some-entry-text) + (lambda (_marker n &rest _) (setq captured n) "text"))) + (with-temp-buffer + (insert "* Card :drill:\nbody\n") + (org-mode) + (goto-char (point-min)) + (org-drill-get-entry-text)) + (should (eq 7 captured))))) + +(provide 'test-org-drill-entry-text-limit) + +;;; test-org-drill-entry-text-limit.el ends here |
