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

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

[elpa] master 9346e96 194/348: Improve the overlay offset


From: Oleh Krehel
Subject: [elpa] master 9346e96 194/348: Improve the overlay offset
Date: Sat, 8 Apr 2017 11:03:55 -0400 (EDT)

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

    Improve the overlay offset
    
    * ivy-overlay.el (ivy-display-function-overlay): Update.
    
    1. When in `org-mode' take into account `org-indent-mode'.
    
    2. When completing a prefix, place it so that it lines up with existing
    text. For example, in an Elisp buffer type "org-" and press "C-M-i". The
    candidates will all start with "org-" and now will line up with the
    "org-" that's already in the buffer. Instead of just being aligned to
    the current point.
---
 ivy-overlay.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ivy-overlay.el b/ivy-overlay.el
index 7a45137..e74e486 100644
--- a/ivy-overlay.el
+++ b/ivy-overlay.el
@@ -69,7 +69,12 @@ Hide the minibuffer contents and cursor."
       (buffer-substring (1- (point)) (point))
       ivy-text
       (buffer-substring (point) (line-end-position))
-      (ivy-left-pad str (current-column))))))
+      (ivy-left-pad str
+                    (+ (if (eq major-mode 'org-mode)
+                           (* org-indent-indentation-per-level 
(org-current-level))
+                         0)
+                       (- ivy-completion-beg ivy-completion-end)
+                       (current-column)))))))
 
 (provide 'ivy-overlay)
 ;;; ivy-overlay.el ends here



reply via email to

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