GNU bug report logs -
#21468
24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0
Previous Next
Full log
View this message in rfc822 format
On Mon, Sep 14, 2015 at 2:17 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> Of course: that's a line of text. Why is that a problem? (I have no
> idea what role is that thin line serving in Magit.)
In this particular case, the overlays are delimiting a "magit region"
(consisting of whole logical lines touched by Emacs' region). This
means the thin line has to move with point, staying just ahead of it.
Here is a demo, eval this in a buffer, then do set-mark-command and
move around a bit:
(require 'cl-lib)
(defvar-local magit-region-overlays nil)
(defun 21468-update-hunk-region (start end window rol)
(mapc #'delete-overlay magit-region-overlays)
(let ((rbeg (save-excursion (goto-char (region-beginning))
(line-beginning-position)))
(rend (save-excursion (goto-char (region-end))
(line-end-position))))
(cl-flet ((ov (start end &rest args)
(let ((ov (make-overlay start end nil t)))
(overlay-put ov 'evaporate t)
(while args (overlay-put ov (pop args) (pop args)))
(push ov magit-region-overlays)
ov)))
(ov rbeg (1+ rbeg) 'before-string
(propertize (concat (propertize "\s" 'display '(space :height (1)))
(propertize "\n" 'line-height t))
'face 'highlight))
(ov rend (1+ rend) 'after-string
(propertize (concat (propertize "\s" 'display '(space :height (1)))
(propertize "\n" 'line-height t))
'face 'highlight)))))
(setq-local redisplay-highlight-region-function '21468-update-hunk-region)
(setq-local redisplay-unhighlight-region-function
(lambda (rol) (mapc #'delete-overlay magit-region-overlays)))
This bug report was last modified 9 years and 286 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.