[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving point around empty overlays with 'after-text
From: |
Eli Zaretskii |
Subject: |
Re: Moving point around empty overlays with 'after-text |
Date: |
Mon, 10 Apr 2023 08:09:30 +0300 |
> Date: Sun, 09 Apr 2023 20:21:09 -0700
> From: Ash <ext0l@catgirl.ai>
>
> When point is on a position with an inlay, the new variable
> point-is-after-inlay (name subject to bikeshedding) controls where point
> renders (before if nil, after if t). When inserting text, the inlay moves
> forward if point-is-after-inlay is nil, and doesn't move if it's t; this
> means characters appear where you'd expect.
How is this different from the front-advance and rear-advance
arguments you can specify when creating the overlay.
> We add a new (forward-char-respecting-inlay) function that sets
> point-is-after-inlay to t if point is at the start of an inlay *and*
> point-is-after-inlay is nil, or increments point if not (and the same for
> backwards). Possibly add an 'always-respect-inlay' mode that makes
> forward-char act like this, with the caveat that things might break in
> strange ways.
>
> Each inlay has a 'bias' of 'before or 'after that indicates what
> point-is-before-inlay should be set to when navigating to it 'from afar' or
> other cases where there's no good heuristic for where to put it; in general,
> this should correspond to where the text is the inlay is semantically
> annotating.
>
> There's probably all kinds of edge cases I haven't thought about, of course.
> Conversely, an even more general approach that would support multiple inlays
> in a row would be to have point-is-after-inlay be an *index* (and rename it
> 'point-inlay-index' or some such). Not sure what a concrete use case for that
> would be.
I think before we invent some new complicated feature we should
explore the ones already there.
Did you look at how set-minibuffer-message succeeds in setting the
cursor? did you try using the same technique?
Did you try both before-string and after-string overlays?
Did you try non-"empty" overlays, i.e. those whose start and end are
not the same buffer position? They can have before-string and
after-string properties as well.
And that is even before considering whether overlays are the best
infrastructure for implementing this stuff in Emacs.
- Re: Moving point around empty overlays with 'after-text, (continued)
- Re: Moving point around empty overlays with 'after-text, tomas, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Ash, 2023/04/09
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/09
- Re: Moving point around empty overlays with 'after-text, Ash, 2023/04/09
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/09
- Re: Moving point around empty overlays with 'after-text, Ash, 2023/04/10
- Re: Moving point around empty overlays with 'after-text,
Eli Zaretskii <=
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Eli Zaretskii, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Eli Zaretskii, 2023/04/10
- Re: Moving point around empty overlays with 'after-text, Platon Pronko, 2023/04/10