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

From: Jonas Bernoulli <[email-masked]>
Date: Thu, 26 Jun 2025 17:08:59 +0200

Stefan Monnier <[email-masked]> writes:

> The patch below adds support to `smerge-refine-region` for keeping
> a kind of "virtual cursor" that shows the "corresponding" point in the
> other part of a diff.

Neat!

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.

Using (space :width 0.1) instead of (space :width 0.5) helps a lot, but
if there are multiple instances on a single line, their widths add up.
If there are multiple such items on a line, it also gets quite noisy,
to the point of being distracting.  Maybe I'll get used to that after
a while; the feature is too new to tell.

I am undecided whether this is needed at all, and suspect it is not just
a matter of familiarity but also personal taste.  I.e., the width should
probably be customizable and zero should be one of the valid values.

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.

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.

     Cheers,
     Jonas