emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil 476f5fbcf1 2/2: Visual X, deletion column respects st


From: ELPA Syncer
Subject: [nongnu] elpa/evil 476f5fbcf1 2/2: Visual X, deletion column respects stick eol
Date: Sat, 30 Mar 2024 21:59:43 -0400 (EDT)

branch: elpa/evil
commit 476f5fbcf1288c5a46a6ba35efe0b8dd1e4dd0ec
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Visual X, deletion column respects stick eol
---
 evil-commands.el | 13 +++++++++++--
 evil-maps.el     |  1 +
 evil-tests.el    | 10 +++++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 2ae01d5c29..9494030fad 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1510,7 +1510,10 @@ Save in REGISTER or in the kill-ring with YANK-HANDLER."
                ;; Special exceptions to ever saving column:
                (not (memq evil-this-motion '(evil-forward-word-begin
                                              evil-forward-WORD-begin))))
-      (move-to-column evil-operator-start-col))))
+      (move-to-column (if (and (eq most-positive-fixnum temporary-goal-column)
+                               (memq last-command '(next-line previous-line)))
+                          temporary-goal-column
+                        evil-operator-start-col)))))
 
 (evil-define-operator evil-delete-line (beg end type register yank-handler)
   "Delete to end of line."
@@ -1526,7 +1529,13 @@ Save in REGISTER or in the kill-ring with YANK-HANDLER."
         (let ((temporary-goal-column most-positive-fixnum)
               (last-command 'next-line))
           (evil-delete beg end 'block register yank-handler))
-      (evil-delete beg end type register yank-handler))))
+      (evil-delete beg end type register yank-handler)
+      (evil-first-non-blank)
+      (when (and (not evil-start-of-line) evil-operator-start-col)
+        (move-to-column (if (and (eq most-positive-fixnum 
temporary-goal-column)
+                                 (memq last-command '(next-line 
previous-line)))
+                            temporary-goal-column
+                          evil-operator-start-col))))))
 
 (evil-define-operator evil-delete-whole-line
   (beg end type register yank-handler)
diff --git a/evil-maps.el b/evil-maps.el
index 4387d8b2e6..284da3cf1b 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -389,6 +389,7 @@
 (define-key evil-visual-state-map "R" 'evil-change-whole-line)
 (define-key evil-visual-state-map "u" 'evil-downcase)
 (define-key evil-visual-state-map "U" 'evil-upcase)
+(define-key evil-visual-state-map "X" 'evil-delete-line)
 (define-key evil-visual-state-map "z=" 'ispell-word)
 (define-key evil-visual-state-map "a" evil-outer-text-objects-map)
 (define-key evil-visual-state-map "i" evil-inner-text-objects-map)
diff --git a/evil-tests.el b/evil-tests.el
index b474770568..4650710c3a 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -2135,7 +2135,7 @@ then enter the text in that file's own buffer."))
       ";; This <buffe[r]> is for notes,
 and for Lisp evaluation."
       ("D")
-      "[a]nd for Lisp evaluation."))
+      "and for Lisp [e]valuation."))
   (ert-info ("Act on each line of block selection")
     (evil-test-buffer
       :visual block
@@ -2218,6 +2218,14 @@ ine3 line3      line3 l\n"))
       ("\C-w")
       "alpha [b]ravo charlie delta")))
 
+(ert-deftest evil-test-visual-X ()
+  "Test `X' in visual state."
+  :tags '(evil)
+  (evil-test-buffer
+    "This is line one\nThis is lin[e] two\nThis is line three"
+    ("v$oX")
+    "This is line one\nThis is lin[e] three"))
+
 (ert-deftest evil-test-delete-back-to-indentation ()
   "Test `evil-delete-back-to-indentation' in insert & replace states."
   :tags '(evil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]