aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Burkett <justin@burkett.cc>2019-08-08 22:11:03 -0400
committerEivind Fonn <evfonn@gmail.com>2019-11-05 10:20:42 +0100
commitaa3ea1dcfc54fe25581841a8685679d482e99b3f (patch)
tree19c82fd33fa456b9b2b54d8487b337f204fe762d
parent45606ec27cbeb7d074ab92658b496950c40dc76b (diff)
Unwed evil-move-beyond-eol and evil-move-cursor-back
The docstring of evil-cursor-back only mentions that it applies to moving the cursor back when exiting insert state, but in many cases it was tied to also moving the cursor when reaching the end of the line. We have evil-move-beyond-eol to control that behavior, and there doesn't seem to be a good reason that the two must be tied together. Fixes #1178
-rw-r--r--evil-commands.el4
-rw-r--r--evil-common.el6
-rw-r--r--evil-macros.el3
-rw-r--r--evil-search.el2
-rw-r--r--evil-states.el11
-rw-r--r--evil-tests.el2
6 files changed, 12 insertions, 16 deletions
diff --git a/evil-commands.el b/evil-commands.el
index d860238..7d87d6b 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -83,8 +83,7 @@ of the line or the buffer; just return nil."
(evil-motion-loop (nil (or count 1))
(forward-char)
;; don't put the cursor on a newline
- (when (and evil-move-cursor-back
- (not evil-move-beyond-eol)
+ (when (and (not evil-move-beyond-eol)
(not (evil-visual-state-p))
(not (evil-operator-state-p))
(eolp) (not (eobp)) (not (bolp)))
@@ -1607,7 +1606,6 @@ of the block."
(when evil-this-motion
(goto-char end)
(when (and evil-cross-lines
- evil-move-cursor-back
(not evil-move-beyond-eol)
(not (evil-visual-state-p))
(not (evil-operator-state-p))
diff --git a/evil-common.el b/evil-common.el
index 2ef3b23..26b6b39 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -1127,13 +1127,13 @@ This function should be used in forward motions. If `point' is close
to eob so that no further forward motion is possible the error
'end-of-buffer is raised. This is the case if `point' is at
`point-max' or if is one position before `point-max',
-`evil-move-cursor-back' is non-nil and `point' is not at the end
+`evil-move-beyond-eol' is nil and `point' is not at the end
of a line. The latter is necessary because `point' cannot be
-moved to `point-max' if `evil-move-cursor-back' is non-nil and
+moved to `point-max' if `evil-move-beyond-eol' is nil and
the last line in the buffer is not empty."
(when (or (eobp)
(and (not (eolp))
- evil-move-cursor-back
+ (not evil-move-beyond-eol)
(save-excursion (forward-char) (eobp))))
(signal 'end-of-buffer nil)))
diff --git a/evil-macros.el b/evil-macros.el
index 117d9d7..66d550d 100644
--- a/evil-macros.el
+++ b/evil-macros.el
@@ -168,8 +168,7 @@ upon reaching the beginning or end of the current line.
(when (save-excursion (goto-char end) (bolp))
(setq end (max beg (1- end))))
;; don't include the newline in Normal state
- (when (and evil-move-cursor-back
- (not evil-move-beyond-eol)
+ (when (and (not evil-move-beyond-eol)
(not (evil-visual-state-p))
(not (evil-operator-state-p)))
(setq end (max beg (1- end))))
diff --git a/evil-search.el b/evil-search.el
index b995866..c622fa5 100644
--- a/evil-search.el
+++ b/evil-search.el
@@ -774,7 +774,7 @@ the direcion is determined by `evil-ex-search-direction'."
(when (eq evil-ex-search-direction 'forward)
(unless (eobp) (forward-char))
;; maybe skip end-of-line
- (when (and evil-move-cursor-back (eolp) (not (eobp)))
+ (when (and (not evil-move-beyond-eol) (eolp) (not (eobp)))
(forward-char)))
(let ((res (evil-ex-find-next nil nil (not evil-search-wrap))))
(cond
diff --git a/evil-states.el b/evil-states.el
index 8cb2c32..8ffc1d6 100644
--- a/evil-states.el
+++ b/evil-states.el
@@ -128,10 +128,10 @@ commands opening a new line."
(evil-set-marker ?^ nil t)
(unless (eq evil-want-fine-undo t)
(evil-end-undo-step))
- (when evil-move-cursor-back
- (when (or (evil-normal-state-p evil-next-state)
- (evil-motion-state-p evil-next-state))
- (evil-move-cursor-back))))))
+ (when (or (evil-normal-state-p evil-next-state)
+ (evil-motion-state-p evil-next-state))
+ (evil-move-cursor-back
+ (and (eolp) (not evil-move-beyond-eol)))))))
(defun evil-insert-repeat-hook ()
"Record insertion keys in `evil-insert-repeat-info'."
@@ -856,8 +856,7 @@ CORNER defaults to `upper-left'."
(remove-hook 'pre-command-hook #'evil-replace-pre-command t)
(unless (eq evil-want-fine-undo t)
(evil-end-undo-step))
- (when evil-move-cursor-back
- (evil-move-cursor-back))))
+ (evil-move-cursor-back)))
(setq evil-replace-alist nil))
(defun evil-replace-pre-command ()
diff --git a/evil-tests.el b/evil-tests.el
index e2480eb..879fed9 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -2694,7 +2694,7 @@ This bufferThis bufferThis buffe[r];; and for Lisp evaluation."))
";[;] This buffer is for notes."))
(ert-info ("End of line")
(let ((evil-cross-lines t)
- (evil-move-cursor-back t))
+ (evil-move-beyond-eol nil))
(evil-test-buffer
";; This buffer is for notes[,]
;; and for Lisp evaluation."