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

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

[elpa] externals/beacon 6eed864 5/6: Fix beacon at end of a long line


From: Stefan Monnier
Subject: [elpa] externals/beacon 6eed864 5/6: Fix beacon at end of a long line
Date: Wed, 17 Mar 2021 18:39:45 -0400 (EDT)

branch: externals/beacon
commit 6eed864c31eb10e382e3c86ee858240cfcdfcd1e
Author: Yang Sheng <yangsheng6810@gmail.com>
Commit: Yang Sheng <yangsheng6810@gmail.com>

    Fix beacon at end of a long line
---
 beacon.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/beacon.el b/beacon.el
index c48d1df..0fbb00f 100644
--- a/beacon.el
+++ b/beacon.el
@@ -232,13 +232,20 @@ If COLORS is nil, OVERLAY is deleted!"
                              "")
                   'cursor 1000))))
 
+(defun beacon--visual-current-column ()
+  "Get the visual column we are at, takes long lines and visual line mode into 
account."
+  (save-excursion
+    (let ((current (point)))
+      (beginning-of-visual-line)
+      (- current (point)))))
+
 (defun beacon--after-string-overlay (colors)
   "Put an overlay at point with an after-string property.
 The property's value is a string of spaces with background
 COLORS applied to each one."
   ;; The after-string must not be longer than the remaining columns
   ;; from point to right window-end else it will be wrapped around.
-  (let ((colors (seq-take colors (- (window-width) (current-column) 1))))
+  (let ((colors (seq-take colors (- (window-width) 
(beacon--visual-current-column) 1))))
     (beacon--ov-put-after-string (beacon--make-overlay 0) colors)))
 
 (defun beacon--ov-at-point ()



reply via email to

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