Ihor Radchenko <[email protected]> writes:
>>> I can get your argument (although, see above), but when the cursor is
>>> literally displayed over the latter [F], it is counter-intuitive for me
>>> that the cursor is outside.
>>
>> I think that's more of a "box shape seems less inside the bar" point of
>> view, which I can see, since the box "intrudes" more into the pixels of
>> the visible string. But box is the default type.
>
> What about additionally changing the cursor shape right before/after the
> emphasis/link: bar cursor inside, box cursor far away (default), and,
> say, (bar . 5).
Sure, all the cursors types (+ face) could be supported. Once there's a
concrete patch people can play with it and see what feels right.
>> So v31 reproduces? Sounds like an introduced bug which should be
>> reported and fixed. Can you tell if it's just skipping the call to the
>> cursor sensor function in some context? Or perhaps calling it with bad
>> data?
>
> ======================================================================
> 1 -> (my/appear-sensor #<window 47 on *org-hidden-test*> 54 entered)
> 1 <- my/appear-sensor: bar
> ======================================================================
> 1 -> (my/appear-sensor #<window 47 on *org-hidden-test*> 55 moved)
> 1 <- my/appear-sensor: t
Aha, not a bug then. Instead there seems to be some new sensor state in v31:
'moved'. Try this:
(defun my/appear-sensor (_win _pos type)
(cond
((eq type 'entered)
(let ((beg (1- (previous-single-property-change (1+ (point))
'cursor-sensor-functions)))
(end (next-single-property-change (point) 'cursor-sensor-functions)))
(move-overlay my/try-inside-overlay beg end)
(setq cursor-type 'bar)))
((eq type 'left)
(setq cursor-type 'box)
(move-overlay my/try-inside-overlay 0 0)
(setq disable-point-adjustment t))))
I've also realized that other tools may set the cursor state. E.g. my
ultra-scroll /hides/ the cursor during scroll and restores it in idle time.
Need to come up with a system for multiple cursor setters to cooperate. At
minimum if cursor-type is nil, probably should leave it alone. And possibly
add some "pending" state (aka what it /would/ be if it weren't nil).