all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Overlay after-string with cursor (Stefan Monnier)
@ 2019-08-11 22:24 otadmor .
  2019-08-11 22:32 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: otadmor . @ 2019-08-11 22:24 UTC (permalink / raw)
  To: help-gnu-emacs, monnier

1.
> 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.
I want the user to be able to move the cursor inside the overlay when
using the after-string property.
> 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.

-- 
Gretz,
Ofir Tadmor

ICQ: 77685691
Mail: otadmor@gmail.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-11 22:24 Overlay after-string with cursor (Stefan Monnier) otadmor .
@ 2019-08-11 22:32 ` Stefan Monnier
  2019-08-11 22:59   ` otadmor .
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2019-08-11 22:32 UTC (permalink / raw)
  To: otadmor .; +Cc: help-gnu-emacs

>> 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 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.

>> 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 :-(


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-11 22:32 ` Stefan Monnier
@ 2019-08-11 22:59   ` otadmor .
  2019-08-12  9:25     ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: otadmor . @ 2019-08-11 22:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-11 22:59   ` otadmor .
@ 2019-08-12  9:25     ` Stefan Monnier
  2019-08-12 10:03       ` otadmor .
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2019-08-12  9:25 UTC (permalink / raw)
  To: otadmor .; +Cc: help-gnu-emacs

> 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?

Something like that, most likely, yes.

> 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

Then you can set/change the `cursor` property as part of the synchronization.

The main problem you'll have is that he overlay's after-string will
never be displayed such that only the "second half" is visible, so if
it spans many lines scrolling will "jump" over those many lines.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-12  9:25     ` Stefan Monnier
@ 2019-08-12 10:03       ` otadmor .
  2019-08-13  7:51         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: otadmor . @ 2019-08-12 10:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

On Mon, Aug 12, 2019, 12:25 Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > 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?
>
> Something like that, most likely, yes.
>
> > 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
>
> Then you can set/change the `cursor` property as part of the
> synchronization.

Thanks

>
> The main problem you'll have is that he overlay's after-string will
> never be displayed such that only the "second half" is visible, so if
> it spans many lines scrolling will "jump" over those many lines.
>
The jump is exactly what I have experienced and did not quite understood
what is hapenning there. Should it be possible to scroll by pixel into the
'after-string?

I am unaware whether some buffer text can be shown in only one window (the
inverse of hidden overlay with window property).
If so I would insert the newlines as real text and set save hook to remove
them before saving. I would have to fix gotoline and such, but these are of
my least concern now.
I could create a fake buffer with the data instead of comparing the
original file. This would fix some more issues as I'm using persp mode and
planing of a dedicated perspective for ediff.


>
>         Stefan
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-12 10:03       ` otadmor .
@ 2019-08-13  7:51         ` Stefan Monnier
  2019-08-13 22:40           ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2019-08-13  7:51 UTC (permalink / raw)
  To: otadmor .; +Cc: help-gnu-emacs

> The jump is exactly what I have experienced and did not quite understood
> what is hapenning there. Should it be possible to scroll by pixel into the
> 'after-string?

Yes, if you want to synchronize the scrolling between two windows, you
can indeed do that (not that it's a separate issue from synchronizing
the cursor).  You can use `set-window-vscroll` for that.
It can be fiddly as well, tho.

> I am unaware whether some buffer text can be shown in only one window (the
> inverse of hidden overlay with window property).

Instead of inserting virtual newlines in only one window, you could take the
opposite approach and really inserting the newlines in the buffer and
then hiding those newlines in all other windows.

Of course, that would still require taking care to remove those newlines
before the buffer is saved (and things get even more delicate if you
want to allow editing the buffer).

> I could create a fake buffer with the data instead of comparing the
> original file.

That might be a much easier option.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Overlay after-string with cursor (Stefan Monnier)
  2019-08-13  7:51         ` Stefan Monnier
@ 2019-08-13 22:40           ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2019-08-13 22:40 UTC (permalink / raw)
  To: help-gnu-emacs

> Yes, if you want to synchronize the scrolling between two windows, you
> can indeed do that (not that it's a separate issue from synchronizing
                      ^^^
                      note

Duh!


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-13 22:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-11 22:24 Overlay after-string with cursor (Stefan Monnier) otadmor .
2019-08-11 22:32 ` Stefan Monnier
2019-08-11 22:59   ` otadmor .
2019-08-12  9:25     ` Stefan Monnier
2019-08-12 10:03       ` otadmor .
2019-08-13  7:51         ` Stefan Monnier
2019-08-13 22:40           ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.