[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 87997ec3cf: Add `evil-v$-excludes-newline`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 87997ec3cf: Add `evil-v$-excludes-newline` |
Date: |
Sat, 30 Apr 2022 15:58:12 -0400 (EDT) |
branch: elpa/evil
commit 87997ec3cfaa475475216dcc37fc38a2301c8ea4
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Add `evil-v$-excludes-newline`
Deprecate `evil-want-visual-char-semi-exclusive`.
Fixes #897
---
doc/source/settings.rst | 2 ++
evil-commands.el | 5 ++++-
evil-tests.el | 31 ++++++++++++-------------------
evil-types.el | 6 ++----
evil-vars.el | 18 +++++++++++++++++-
5 files changed, 37 insertions(+), 25 deletions(-)
diff --git a/doc/source/settings.rst b/doc/source/settings.rst
index 125d7d6c7a..3d01e02e8f 100644
--- a/doc/source/settings.rst
+++ b/doc/source/settings.rst
@@ -116,6 +116,8 @@ of them can be tweaked using the following variables.
.. elisp:autovariable:: evil-move-beyond-eol
+.. elisp:autovariable:: evil-v$-excludes-newline
+
.. elisp:autovariable:: evil-cross-lines
.. elisp:autovariable:: evil-respect-visual-line-mode
diff --git a/evil-commands.el b/evil-commands.el
index c8d8f782a3..fbcc9d873e 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -191,7 +191,10 @@ If COUNT is given, move COUNT - 1 lines downward first."
(when evil-track-eol
(setq temporary-goal-column most-positive-fixnum
this-command 'next-line))
- (unless (evil-visual-state-p)
+ (if (evil-visual-state-p)
+ (when evil-v$-excludes-newline
+ (let ((evil-move-beyond-eol nil))
+ (evil-adjust-cursor)))
(evil-adjust-cursor)
(when (eolp)
;; prevent "c$" and "d$" from deleting blank lines
diff --git a/evil-tests.el b/evil-tests.el
index ff896a547a..1eaf1e8a48 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -3370,7 +3370,17 @@ Below some empty line"
("d$")
"Above some line
\[]
-Below some empty line")))
+Below some empty line"))
+ (ert-info ("Visual state")
+ (evil-test-buffer
+ "f[o]o\nbar"
+ ("v$")
+ "f<oo\n>bar")
+ (let ((evil-v$-excludes-newline t))
+ (evil-test-buffer
+ "f[o]o\nbar"
+ ("v$")
+ "f<oo>\nbar"))))
(ert-deftest evil-test-percentage-of-line ()
"Test `evil-percentage-of-line' motion"
@@ -7036,24 +7046,7 @@ test hello <a href=\"/deed.zh\">Creative Commons</a>
;; and for Lisp evaluation."
("vV")
"<;; [ ]buffer is for notes you don't want to save,\n>\
-;; and for Lisp evaluation.")
- (ert-info ("Test `evil-want-visual-char-semi-exclusive")
- (let ((evil-want-visual-char-semi-exclusive t))
- (evil-test-buffer
- "[;]; This buffer is for notes you don't want to save,
-;; and for Lisp evaluation.
-;; And a third line."
- ("v")
- "<[;]>; This buffer is for notes you don't want to save,
-;; and for Lisp evaluation.
-;; And a third line."
- ("$")
- "<;; This buffer is for notes you don't want to save,>[
-];; and for Lisp evaluation.
-;; And a third line."
- ("^jj")
- "<;; This buffer is for notes you don't want to save,
-;; and for Lisp evaluation.\n>[;]; And a third line."))))
+;; and for Lisp evaluation."))
(ert-deftest evil-test-visual-line ()
"Test Visual line selection"
diff --git a/evil-types.el b/evil-types.el
index bc5cd3e243..a230b3cfa8 100644
--- a/evil-types.el
+++ b/evil-types.el
@@ -90,10 +90,8 @@ If the end position is at the beginning of a line, then:
(evil-define-type inclusive
"Include the character under point.
-If the end position is at the beginning of a line or the end of a
-line and `evil-want-visual-char-semi-exclusive', then:
-
-* If in visual state return `exclusive' (expanded)."
+Handling for `evil-want-visual-char-semi-exclusive' is deprecated,
+and will be removed in a future version."
:expand (lambda (beg end)
(if (and evil-want-visual-char-semi-exclusive
(evil-visual-state-p)
diff --git a/evil-vars.el b/evil-vars.el
index 7f765e0b47..3b1635e489 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1081,7 +1081,10 @@ These commands work better without this newline."
:initialize 'evil-custom-initialize-pending-reset)
(defcustom evil-want-visual-char-semi-exclusive nil
- "Visual character selection to beginning/end of line is exclusive.
+ "DEPRECATED. Will be removed in a future version.
+Prefer to set `evil-v$-excludes-newline' to non-nil.
+
+Visual character selection to beginning/end of line is exclusive.
If non nil then an inclusive visual character selection which
ends at the beginning or end of a line is turned into an
exclusive selection. Thus if the selected (inclusive) range ends
@@ -1091,6 +1094,19 @@ of a line it is changed to not include the newline
character of
that line."
:type 'boolean
:group 'evil)
+(make-obsolete-variable
+ evil-want-visual-char-semi-exclusive
+ "Semi-exclusivity prevents selecting text + 1st char of next line,
+without having to introduce new niche functionality.
+Prefer to set `evil-v$-excludes-newline' to non-nil."
+ "1.15.0")
+
+(defcustom evil-v$-excludes-newline nil
+ "If non-nil, `evil-end-of-line' does not move as far as to include
+the `\n' char at eol. This makes `v$' consistent with `$' used as a
+motion (e.g. `v$y' is consistent with `y$' in normal state)."
+ :type 'boolean
+ :group 'evil)
(defcustom evil-text-object-change-visual-type t
"Text objects change the current visual state type.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil 87997ec3cf: Add `evil-v$-excludes-newline`,
ELPA Syncer <=