Subject: 24179

From: Jonas Bernoulli <[email-masked]>
Date: Thu, 11 Aug 2016 18:39:54 +0200

Thanks Eli!

> Btw, magit-blame could be nicer to the display engine by placing a
> 'cursor' property on the first character of each before-string it
> creates to show the blamed commit.

After reading the documentation, I cannot quite figure what I am
supposed to do.  Given this:

(with-current-buffer (get-buffer-create "demo")
  (pop-to-buffer (current-buffer))
  (erase-buffer)
  (insert "one\ntwo\nthree")
  (backward-word 2)
  (let ((ov (make-overlay (point)
                          (save-excursion
                            (forward-line 1)
                            (point))))
        (heading "before two\n"))
    (overlay-put ov 'before-string heading)
    (overlay-put ov 'the-value "two")
    (overlay-put ov 'evaporate t)))

I think I am supposed to change it to:

(with-current-buffer (get-buffer-create "demo")
  (pop-to-buffer (current-buffer))
  (erase-buffer)
  (insert "one\ntwo\nthree")
  (backward-word 2)
  (let ((ov (make-overlay (point)
                          (save-excursion
                            (forward-line 1)
                            (point))))
        (heading "before two\n"))
    (put-text-property 0 1 'cursor (length heading) heading)
    (overlay-put ov 'before-string heading)
    (overlay-put ov 'the-value "two")
    (overlay-put ov 'evaporate t)))

However I would then expect that it would become possible for the cursor
to be displayed "on" the "b" because of this: "In other words, the
string character with the ‘cursor’ property of any non-‘nil’ value is
the character where to display the cursor.  The value of the property
says for which buffer positions to display the cursor there."

one
*efore two
two
three

That would be a change in behavior* but I am not seeing any change so I
am unsure whether I am doing this all wrong.  If so, then please correct
the above code.

* However if that is possible, I would prefer to use the `cursor'
property to provide the hint to the display engine that the cursor
should keep ending up here (as it does without fiddling with `cursor' at
all):

one
before two
*wo
three

Given "the cursor will be displayed on this character for any buffer
position in the range `[OVPOS..OVPOS+N)'", I don't see how I can say
"display the cursor HERE instead of at the positions BEFORE HERE as
specified by N".