GNU bug report logs - #21468
24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Sun, 13 Sep 2015 05:18:01 UTC

Severity: normal

Found in version 24.5

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #25 received at 21468 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21468 <at> debbugs.gnu.org
Subject: Re: bug#21468: 24.5; When next-line (visual) crosses overlay with
 before-string="\n" point goes to column 0
Date: Mon, 14 Sep 2015 08:46:57 -0400
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 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.