Subject: bug#78806: [PATCH] (smerge-refine-region): Add support for a virtual "other cursor"

From: Stefan Monnier <[email-masked]>
Date: Thu, 26 Jun 2025 12:52:59 -0400

> Unfortunately the before-string added by smerge--refine-highlight-change
> result in misalignment, making it hard to be confident about the
> correctness of whitespace changes when looking at diffs only.

Oh, my, I hadn't noticed that I included this part of my local hacks.
It's not directly related to the shadow-cursor (well, except that
I coded it at the same time some months ago).

The misalignment makes it definitely not acceptable (at least for the
default config).  I've now commented out that code.

> Using (space :width 0.1) instead of (space :width 0.5) helps a lot, but

It's still jarring.

> I am undecided whether this is needed at all,

It's not.  I personally want(ed?) some way to highlight the "insertion"
place, and that is the state of that current experiment.
It was not meant for `master`.

> I have experimented with using an "incomplete box" instead of a before-
> string.
>
> -              (overlay-put ol (if (= beg olbeg) 'before-string 'after-string)
> -                           (propertize
> -                            " " (car-safe x) (cdr-safe x)
> -                            'display '(space :width 0.5)))))
> +              (overlay-put ol 'face '(:box (:line-width (-2 . 0) :style nil)))))
>
> Unfortunately that draws two lines.

Yup.  🙁

> It would be nice if the widths of the four sides of a box could be set
> individually, not just in pairs.  (Adding two new overlay properties
> before-line and after-line, which handle negative values the same as
> the :line-width of :box, might also be an option.)  I am bringing such
> lines up in the context of this new feature, but this is not the first
> time I wished something like this existed.

That would be a nice way to provide the feature I want without
introducing the kind of misalignment that my current hack causes, yes.
It should be fairly easy to extend `:line-width` to allow
4 distinct numbers.

        Stefan