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

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

[elpa] master 413bf7f 135/348: ivy.el: Prevent region expanding to promp


From: Oleh Krehel
Subject: [elpa] master 413bf7f 135/348: ivy.el: Prevent region expanding to prompt
Date: Sat, 8 Apr 2017 11:03:43 -0400 (EDT)

branch: master
commit 413bf7f9f03ceeb50930537dee7c43c515925e53
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el: Prevent region expanding to prompt
    
    * ivy.el (ivy--insert-minibuffer): Restore the old mark position.
    
    Due to text being deleted and added, the mark moved. Now it's possible
    to e.g. to:
    
    - "C-x h DEL" to clear the buffer.
    - "M-i M-m M-w" to copy the current candidate (uses `lispy-mark-symbol' on 
"M-m")
---
 ivy.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ivy.el b/ivy.el
index 8926f6a..05b34f7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2205,6 +2205,7 @@ Should be run via minibuffer `post-command-hook'."
   "Insert TEXT into minibuffer with appropriate cleanup."
   (let ((resize-mini-windows nil)
         (update-fn (ivy-state-update-fn ivy-last))
+        (old-mark (marker-position (mark-marker)))
         deactivate-mark)
     (ivy--cleanup)
     (when update-fn
@@ -2217,7 +2218,10 @@ Should be run via minibuffer `post-command-hook'."
           (forward-line 1)
           (insert text))))
     (when (display-graphic-p)
-      (ivy--resize-minibuffer-to-fit))))
+      (ivy--resize-minibuffer-to-fit))
+    ;; prevent region growing due to text remove/add
+    (when (region-active-p)
+      (set-mark old-mark))))
 
 (defun ivy--resize-minibuffer-to-fit ()
   "Resize the minibuffer window size to fit the text in the minibuffer."



reply via email to

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