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

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

bug#20847: [display engine] 25.0.50; company-mode popup makes point jump


From: Eli Zaretskii
Subject: bug#20847: [display engine] 25.0.50; company-mode popup makes point jump to an entirely different location
Date: Sun, 21 Jun 2015 21:24:39 +0300

> Cc: 20847@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Sun, 21 Jun 2015 21:06:07 +0300
> 
> On 06/21/2015 07:43 PM, Eli Zaretskii wrote:
> 
> > Any scenario where a screen line ends in a newline that comes from an
> > overlay string.  Try several such scenarios, and then tell me whether
> > the place we display the cursor looks better than the alternative.
> 
> Hmm, yeah, after sounds better that before. But we do display point in 
> the margin on step 6. So it must be possible.

I'm quite sure the code which is responsible simply doesn't check.

> > Emacs cannot move cursor except by moving point, I'm sure you know
> > that.  The only exception is when we show the cursor on a display or
> > overlay string, guided by the 'cursor' property.  There are no other
> > exceptions.
> 
> Not really. I only know that *I* can't move cursor by any other means.
> 
> I also vaguely recall someone (yourself?) stating that this limitation 
> could be lifted without too much work.

It should be possible, yes.  I was describing how the code works now.

> >> See the bottom of `company--replacement-string'. If `cursor' is applied
> >> unconditionally, and if I change the arguments 0 and 1 to 1 and 2, on
> >> step 6 the cursor is displayed at the beginning of the next line (so we
> >> know the change has effect), but the second problem (after step 9) is
> >> still present.
> >
> > AFAICT, this will put the 'cursor' property on a character that is
> > after the leading newline of the overlay string, yes?
> 
> True.
> 
> > If so, that's
> > not going to work: you need th 'cursor' property on some glyph that is
> > displayed on the same line where the newline is.
> 
> Augh.
> 
> Like mentioned in the previous message, I don't see a good, 
> non-user-confusing place for it on the same line. The beginning of the 
> next line would've worked reasonably well, though.

Then what you had in mind should do the trick, I think.

> I'd also accept the cursor not being displayed at all.

That's tricky.  We only do that due to hscroll, I think.

>  > That is, you need to
> > make at least one character of "hel" part of the overlay string, and
> > put the 'cursor' property on it, making its value large enough to
> > "cover" the position of the newline.
> 
> I was kinda hoping that "overlay with display string starting with 
> newline" was the only issue.

That's not an issue at all.

What we need is some way of telling the display engine that this is
where we want the cursor, so it could include that clue in its logic.

Hmm... would it be possible to put a 'cursor' property on the newline
in the buffer that follows the "hel" text?  That might be all that's
needed to DTRT.

> >> - The bug only manifests after the step 9 (backspacing), whereas the
> >> whole explanation seems to apply to the step 6 as well. Yet, point stays
> >> in place there.
> >
> > Like I said, I didn't investigate that.  I think some redisplay
> > optimization is responsible.  If it's important to have the same
> > (mis)behavior in both cases, I can look into that.
> 
> Couldn't the same optimization have a reason to be enabled in both 
> cases? It might be worth investigating, at least.

I will see what I can do.

> Consistent behavior would also be good; so that the users don't have to 
> try too hard to catch problematic cases like this one.

I think we should try keeping point at the locus of
insertion/deletion.





reply via email to

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