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

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

[elpa] master bb5d0d4 119/399: ivy-overlay.el (ivy-display-function-over


From: Oleh Krehel
Subject: [elpa] master bb5d0d4 119/399: ivy-overlay.el (ivy-display-function-overlay): Refactor
Date: Sat, 20 Jul 2019 14:57:04 -0400 (EDT)

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

    ivy-overlay.el (ivy-display-function-overlay): Refactor
---
 ivy-overlay.el | 55 +++++++++++++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/ivy-overlay.el b/ivy-overlay.el
index 1d4305c..1c10746 100644
--- a/ivy-overlay.el
+++ b/ivy-overlay.el
@@ -109,35 +109,34 @@ Hide the minibuffer contents and cursor."
           (insert str)))
     (ivy-add-face-text-property (minibuffer-prompt-end) (point-max)
                                 '(:foreground "white"))
-    (let ((cursor-pos (1+ (- (point) (minibuffer-prompt-end))))
-          (ivy-window (ivy--get-window ivy-last)))
+    (setq cursor-type nil)
+    (with-selected-window (ivy--get-window ivy-last)
+      (when cursor-type
+        (setq ivy--old-cursor-type cursor-type))
       (setq cursor-type nil)
-      (with-selected-window ivy-window
-        (when cursor-type
-          (setq ivy--old-cursor-type cursor-type))
-        (setq cursor-type nil)
-        (let ((overlay-str
-               (apply
-                #'concat
-                (buffer-substring (max (point-min) (1- (point))) (point))
-                ivy-text
-                (and (eolp) " ")
-                (buffer-substring (point) (line-end-position))
-                (and (> (length str) 0)
-                     (list "\n"
-                           (ivy-left-pad
-                            (ivy--remove-prefix "\n" str)
-                            (+ (if (and (eq major-mode 'org-mode)
-                                        (bound-and-true-p org-indent-mode))
-                                   (* org-indent-indentation-per-level
-                                      (org-current-level))
-                                 0)
-                               (save-excursion
-                                 (goto-char ivy-completion-beg)
-                                 (current-column)))))))))
-          (ivy-add-face-text-property cursor-pos (1+ cursor-pos)
-                                      'ivy-cursor overlay-str t)
-          (ivy-overlay-show-after overlay-str))))))
+      (let ((overlay-str
+             (apply
+              #'concat
+              (buffer-substring (max (point-min) (1- (point))) (point))
+              ivy-text
+              (and (eolp) " ")
+              (buffer-substring (point) (line-end-position))
+              (and (> (length str) 0)
+                   (list "\n"
+                         (ivy-left-pad
+                          (ivy--remove-prefix "\n" str)
+                          (+
+                           (if (and (eq major-mode 'org-mode)
+                                    (bound-and-true-p org-indent-mode))
+                               (* org-indent-indentation-per-level 
(org-current-level))
+                             0)
+                           (save-excursion
+                             (goto-char ivy-completion-beg)
+                             (current-column)))))))))
+        (let ((cursor-offset (1+ (length ivy-text))))
+          (ivy-add-face-text-property cursor-offset (1+ cursor-offset)
+                                      'ivy-cursor overlay-str t))
+        (ivy-overlay-show-after overlay-str)))))
 
 (provide 'ivy-overlay)
 



reply via email to

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