|
3 | 3 | ;; Author: Mats Lidell <[email protected]>
|
4 | 4 | ;;
|
5 | 5 | ;; Orig-Date: 23-Apr-21 at 20:55:00
|
6 |
| -;; Last-Mod: 31-Jul-24 at 01:46:48 by Bob Weiner |
| 6 | +;; Last-Mod: 16-Nov-24 at 09:45:51 by Mats Lidell |
7 | 7 | ;;
|
8 | 8 | ;; SPDX-License-Identifier: GPL-3.0-or-later
|
9 | 9 | ;;
|
@@ -225,6 +225,58 @@ This is independent of the setting of `hsys-org-enable-smart-keys'."
|
225 | 225 | (hsys-org--agenda-tags-string => ":tag"))
|
226 | 226 | (should (string= "agenda-func" (hsys-org-get-agenda-tags #'agenda-func)))))
|
227 | 227 |
|
| 228 | +(ert-deftest hsys-org--meta-return-on-end-of-line () |
| 229 | + "Verify end-of-line behaves as `org-mode' when smart keys not enabled." |
| 230 | + (dolist (v '(nil :buttons)) |
| 231 | + (let ((hsys-org-enable-smart-keys v)) |
| 232 | + ;;; One line no return |
| 233 | + (with-temp-buffer |
| 234 | + (org-mode) |
| 235 | + (insert "* h1") |
| 236 | + (goto-char 1) |
| 237 | + (end-of-line) |
| 238 | + (with-mock |
| 239 | + (mock (hsys-org-meta-return) => t) |
| 240 | + (should (equal hsys-org-enable-smart-keys v)) ; Ert traceability |
| 241 | + (should (action-key)))) |
| 242 | + ;;; Two lines |
| 243 | + (with-temp-buffer |
| 244 | + (org-mode) |
| 245 | + (insert "* h1\n* h2\n") |
| 246 | + (goto-char 1) |
| 247 | + (end-of-line) |
| 248 | + (with-mock |
| 249 | + (mock (hsys-org-meta-return) => t) |
| 250 | + (should (equal hsys-org-enable-smart-keys v)) ; Ert traceability |
| 251 | + (should (action-key)))))) |
| 252 | + (let ((hsys-org-enable-smart-keys t) |
| 253 | + (v t)) |
| 254 | + ;;; One line no return |
| 255 | + ;; At end of line is also end of file so smart-eolp filters out |
| 256 | + ;; this as a Hyperbole context and org instead picks it |
| 257 | + ;; up. Possibly a confusing behavior!? Should eof only be when |
| 258 | + ;; action is below last visible line to avoid this case? |
| 259 | + (with-temp-buffer |
| 260 | + (org-mode) |
| 261 | + (insert "* h1") |
| 262 | + (goto-char 1) |
| 263 | + (end-of-line) |
| 264 | + (with-mock |
| 265 | + (mock (hsys-org-meta-return) => t) |
| 266 | + (should (equal hsys-org-enable-smart-keys v)) ; Ert traceability |
| 267 | + (should (action-key)))) |
| 268 | + ;;; Two lines |
| 269 | + ;; Hyperbole context is active and smart scroll is triggered. |
| 270 | + (with-temp-buffer |
| 271 | + (org-mode) |
| 272 | + (insert "* h1\n* h2\n") |
| 273 | + (goto-char 1) |
| 274 | + (end-of-line) |
| 275 | + (with-mock |
| 276 | + (mock (smart-scroll-up) => t) |
| 277 | + (should (equal hsys-org-enable-smart-keys v)) ; Ert traceability |
| 278 | + (should (action-key)))))) |
| 279 | + |
228 | 280 | (provide 'hsys-org-tests)
|
229 | 281 |
|
230 | 282 | ;; This file can't be byte-compiled without the `el-mock' package
|
|
0 commit comments