[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 5da6ef0697 1/3: Fix #1557 (ensure-column fix) (#1560)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 5da6ef0697 1/3: Fix #1557 (ensure-column fix) (#1560) |
Date: |
Mon, 3 Jan 2022 08:58:16 -0500 (EST) |
branch: elpa/evil
commit 5da6ef06971d8330a55b9be2b794399f36f4b79e
Author: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Fix #1557 (ensure-column fix) (#1560)
---
evil-common.el | 5 +++--
evil-tests.el | 7 +++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/evil-common.el b/evil-common.el
index 8c5b822c68..f4c882e01c 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -985,7 +985,8 @@ See also `evil-save-goal-column'."
(eolp))))
(defmacro evil-ensure-column (&rest body)
- "Execute BODY as if it is a `next-line' command, insofar as it tracks column.
+ "Execute BODY so that column after execution is correct.
+If `evil-start-of-line' is nil, treat BODY as if it were a `next-line' command.
This mostly copies the approach of Emacs' `line-move-1', but is modified
so it is more compatible with evil's notions of eol & tracking."
(declare (indent defun)
@@ -995,7 +996,7 @@ so it is more compatible with evil's notions of eol &
tracking."
(setq temporary-goal-column (+ (car temporary-goal-column)
(cdr temporary-goal-column))))))
`(progn
- (setq this-command 'next-line)
+ (unless evil-start-of-line (setq this-command 'next-line))
,normalize-temporary-goal-column
(if (not (memq last-command '(next-line previous-line)))
(setq temporary-goal-column
diff --git a/evil-tests.el b/evil-tests.el
index be03b05582..53f57761f1 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -3294,6 +3294,13 @@ The longest lin[e]"
Average line
The longest line")))
+ (ert-info ("evil-goto-line respects evil-start-of-line")
+ (let ((evil-start-of-line t))
+ (evil-test-buffer
+ "foo\n[b]ar"
+ ("$ggj")
+ "foo\n[b]ar")))
+
(ert-info ("N% (`evil-jump-item' with count) can preserve column")
(let ((evil-start-of-line nil))
(evil-test-buffer