[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil b799fca7ad: Add `evil-select-an-unrestricted-object`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil b799fca7ad: Add `evil-select-an-unrestricted-object` |
Date: |
Sat, 30 Apr 2022 18:58:05 -0400 (EDT) |
branch: elpa/evil
commit b799fca7adc70536c0c832cb297ce2b8cfe2ae96
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Add `evil-select-an-unrestricted-object`
---
evil-commands.el | 6 +++---
evil-common.el | 16 +++++++++++++++-
evil-tests.el | 10 +++++++++-
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index 064873d091..c371accdf7 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1292,7 +1292,7 @@ or line COUNT to the top of the window."
(evil-define-text-object evil-a-symbol (count &optional beg end type)
"Select a symbol."
- (evil-select-an-object 'evil-symbol beg end type count))
+ (evil-select-an-unrestricted-object 'evil-symbol beg end type count))
(evil-define-text-object evil-inner-symbol (count &optional beg end type)
"Select inner symbol."
@@ -1300,7 +1300,7 @@ or line COUNT to the top of the window."
(evil-define-text-object evil-a-sentence (count &optional beg end type)
"Select a sentence."
- (evil-select-an-object 'evil-sentence beg end type count))
+ (evil-select-an-unrestricted-object 'evil-sentence beg end type count))
(evil-define-text-object evil-inner-sentence (count &optional beg end type)
"Select inner sentence."
@@ -1309,7 +1309,7 @@ or line COUNT to the top of the window."
(evil-define-text-object evil-a-paragraph (count &optional beg end type)
"Select a paragraph."
:type line
- (evil-select-an-object 'evil-paragraph beg end type count t))
+ (evil-select-an-unrestricted-object 'evil-paragraph beg end type count t))
(evil-define-text-object evil-inner-paragraph (count &optional beg end type)
"Select inner paragraph."
diff --git a/evil-common.el b/evil-common.el
index e28fc5c7a5..d755120d84 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -3146,7 +3146,7 @@ linewise, otherwise it is character wise."
(save-excursion (end-of-line) (point)))
(evil-select-inner-unrestricted-object thing beg end type count line)))
-(defun evil-select-an-object (thing beg end type count &optional line)
+(defun evil-select-an-unrestricted-object (thing beg end type count &optional
line)
"Return an outer text object range of COUNT objects.
If COUNT is positive, return objects following point; if COUNT is
negative, return objects preceding point. If one is unspecified,
@@ -3222,6 +3222,20 @@ linewise, otherwise it is character wise."
(if line 'line type)
:expanded t)))
+(defun evil-select-an-object (thing beg end type &optional count line)
+ "Return an outer text object range of COUNT objects.
+Selection is restricted to the current line.
+If COUNT is positive, return objects following point; if COUNT is
+negative, return objects preceding point. If one is unspecified,
+the other is used with a negative argument. THING is a symbol
+understood by thing-at-point. BEG, END and TYPE specify the
+current selection. If LINE is non-nil, the text object should be
+linewise, otherwise it is character wise."
+ (save-restriction
+ (narrow-to-region (save-excursion (beginning-of-line) (point))
+ (save-excursion (end-of-line) (point)))
+ (evil-select-an-unrestricted-object thing beg end type count line)))
+
(defun evil--get-block-range (op cl selection-type)
"Return the exclusive range of a visual selection.
OP and CL are pairs of buffer positions for the opening and
diff --git a/evil-tests.el b/evil-tests.el
index eb5b131767..e3c251d034 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -5959,7 +5959,15 @@ Line 2"))
(evil-test-buffer
"fo[o]\nbar"
("diW")
- "[\n]bar")))
+ "[\n]bar")
+ (evil-test-buffer
+ "foo\n [ ] bar"
+ ("daw")
+ "foo\n[]")
+ (evil-test-buffer
+ "foo\n [ ] bar"
+ ("daW")
+ "foo\n[]")))
(ert-deftest evil-test-word-objects-cjk ()
"Test `evil-inner-word' and `evil-a-word' on CJK words"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil b799fca7ad: Add `evil-select-an-unrestricted-object`,
ELPA Syncer <=