[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 2e8576188b: Only restrict objects when current line i
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 2e8576188b: Only restrict objects when current line is not empty (#1721) |
Date: |
Tue, 22 Nov 2022 09:58:44 -0500 (EST) |
branch: elpa/evil
commit 2e8576188b1d0768fbf92c6bea2fb3fbed9f019f
Author: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Only restrict objects when current line is not empty (#1721)
---
evil-common.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/evil-common.el b/evil-common.el
index ba9f1374dc..15095d9ff4 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -3153,7 +3153,7 @@ linewise, otherwise it is character wise."
(defun evil-select-inner-restricted-object (thing beg end type &optional count
line)
"Return an inner text object range of COUNT objects.
-Selection is restricted to the current line.
+Selection is restricted to the current line, unless it is empty.
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
@@ -3161,8 +3161,10 @@ 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)))
+ (let ((start (save-excursion (beginning-of-line) (point)))
+ (end (save-excursion (end-of-line) (point))))
+ (when (/= start end)
+ (narrow-to-region start end)))
(evil-select-inner-object thing beg end type count line)))
(defun evil-select-an-object (thing beg end type count &optional line)
@@ -3246,7 +3248,7 @@ linewise, otherwise it is character wise."
(defun evil-select-a-restricted-object (thing beg end type &optional count
line)
"Return an outer text object range of COUNT objects.
-Selection is restricted to the current line.
+Selection is restricted to the current line, unless it is empty.
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
@@ -3254,8 +3256,10 @@ 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)))
+ (let ((start (save-excursion (beginning-of-line) (point)))
+ (end (save-excursion (end-of-line) (point))))
+ (when (/= start end)
+ (narrow-to-region start end)))
(evil-select-an-object thing beg end type count line)))
(defun evil--get-block-range (op cl selection-type)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil 2e8576188b: Only restrict objects when current line is not empty (#1721),
ELPA Syncer <=