help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overlay after-string with cursor (Stefan Monnier)


From: otadmor .
Subject: Re: Overlay after-string with cursor (Stefan Monnier)
Date: Mon, 12 Aug 2019 01:59:51 +0300

On Mon, Aug 12, 2019 at 1:32 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> >> You can control where the cursor is displayed in the after-string, with
> >> the `cursor` property.  Doing in it such a way that it gives the
> >> illusion that you can put the cursor "wherever you want" can be a bit
> >> fiddly
> > As I understand, setting the cursor property allows me to put the
> > cursor only in one position inside my overlay.
>
> AFAIK the cursor is never at two places at the same time, so that's not
> a problem.
I might not understand the purpose of the 'cursor property. As I
understood it allows to put the cursor in a fixed position inside the
overlay.
I want the user to use the arrow keys to move it inside the overlay.
>
> > I want the user to be able to move the cursor inside the overlay when
> > using the after-string property.
>
> You can, by changing the `cursor` property whenever you want the cursor
> to change position.
Do I have to re-bind the key map of the overlay so it would accept the
arrow keys and change the 'cursor property accordingly?
It would be hard because this would not support, for example, page up
from outside the overlay into the overlay.
Should I do these calculations manually?
>
> >> so I think it's worth clarifying why exactly you want something
> >> like that, so as to be better decide how to attack the problem.
> > Im trying to implement something visually similar to what vimdiff has,
> > as in this URL:
> > https://www.thegeekstuff.com/2010/06/vimdiff-file-diff-tool/
> > In there, you can see the lines filled with "....................."
> > where there is no content in the line of the first file and there is
> > content in the matching line in the second file.
> > Hope this makes it clearer and that I managed to reply this thread 
> > correctly.
>
> That doesn't explain why you care about the cursor positioning in those
> spaces that don't correspond to any real line, so I'm afraid it doesn't
> make it clearer :-(
>
Generally it is easier for me (and other people I know) to understand
diffs when the lines in the files are "aligned" to each other. As the
diff become bigger there are more added spaces (empty lines), and the
more spaces it is harder to navigate inside the files diff. Using the
arrow keys makes the navigation easier. currently I have synchronized
both buffers (side A and side B, C and ancestor) to received the arrow
keys presses on the "ediff help buffer" (I have created a new
"ediff-operate-on-windows" to support this). The problem is that when
using the after-string (or display) property the cursor is stuck in
one location in the overlay and doesnt move inside it. The
synchronization is not working because of it.
I though of a different solution than using the after string. I can
really add the new empty lines into the buffer where there are diffs,
but this creates other issues when this buffer is saved or shown on a
different window. If only I was able to show a text in a buffer only
in one window this could also solve the problem (and actually treading
this as a text, unlike after-string). Adding the new lines the the
buffer solves the navigation problems.
>
>         Stefan
>


-- 
Gretz,
Ofir Tadmor

ICQ: 77685691
Mail: otadmor@gmail.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]