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

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

[elpa] master 8db9cc1 349/399: swiper.el (swiper--add-cursor-overlay): A


From: Oleh Krehel
Subject: [elpa] master 8db9cc1 349/399: swiper.el (swiper--add-cursor-overlay): Avoid a very wide cursor on tab chars
Date: Sat, 20 Jul 2019 14:57:55 -0400 (EDT)

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

    swiper.el (swiper--add-cursor-overlay): Avoid a very wide cursor on tab 
chars
    
    It's still not the full solution:
    
        (insert "FOO\tasdfasdfasdfasfasdfffoo\tend")
    
    Looking for the second "oo", the added space char will result the tab
    to expand from 1 char to the full 8 chars.
    
    But `whitespace-mode' does this as well, so I assume the solution is
    not trivial.
---
 swiper.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/swiper.el b/swiper.el
index 70b0f55..cf4f41a 100644
--- a/swiper.el
+++ b/swiper.el
@@ -816,8 +816,9 @@ Matched candidates should have `swiper-invocation-face'."
     (setq swiper--isearch-highlight-timer nil)))
 
 (defun swiper--add-cursor-overlay (wnd)
-  (let ((ov (make-overlay (point) (if (eolp) (point) (1+ (point))))))
-    (if (eolp)
+  (let* ((special (or (eolp) (looking-at "\t")))
+         (ov (make-overlay (point) (if special (point) (1+ (point))))))
+    (if special
         (overlay-put ov 'after-string (propertize " " 'face 'ivy-cursor))
       (overlay-put ov 'face 'ivy-cursor))
     (overlay-put ov 'window wnd)



reply via email to

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