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

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

[debbugs-tracker] bug#18504: closed (24.3.93; posn-at-point intermittent


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#18504: closed (24.3.93; posn-at-point intermittently returns wrong value for a valid buffer position)
Date: Tue, 23 Sep 2014 18:40:03 +0000

Your message dated Tue, 23 Sep 2014 22:39:49 +0400
with message-id <address@hidden>
and subject line Re: bug#18504: 24.3.93;        posn-at-point intermittently 
returns wrong value for a valid buffer     position
has caused the debbugs.gnu.org bug report #18504,
regarding 24.3.93; posn-at-point intermittently returns wrong value for a valid 
buffer position
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
18504: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18504
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3.93; posn-at-point intermittently returns wrong value for a valid buffer position Date: Fri, 19 Sep 2014 04:56:04 +0400
(Not a regression, same in Emacs 24.3).

I've been trying to understand what triggers this and create a smaller
repro case, but so far had no luck. So we'll use the company package.

1. git clone https://github.com/company-mode/company-mode.git

2. cd company-mode; git checkout foofoofoo

(Note that the last commit in this branch adds a `message' call that
outputs a multiline string. This doesn't seem to be mandatory, but makes
reproduction easier).

3. emacs -L . -Q

4. (require 'company)
M-x global-company-mode
;; Pick another binding if you're in tty
(global-set-key (kbd "C-/") 'company-complete-common)

5. Type `C-o' several times, so that there are a few empty lines under
the current one.

6. Type `  a'. Again not mandatory, but I've had better odds of
reproduction with this line content.

7. Quickly and repeatedly mash `C-/' and `C-g', a lot.

You'll see the popup appearing under the current line and column, but
sometimes noticeably displaced to the right (like by 15 columns). If it
doesn't happen, try mashing the keys in different rhythms, faster or
slower, and kind of simultaneously (not alternating).

After you've seen it, eval (setq bidi-display-reordering nil).

Mash the keys again, now the popup will occasionally be displayed below
its intended position, by 11 lines or so.

If you add some debugging output to `company--col-row', you'll see that,
for the same value of POS, (posn-at-point pos) returns in these odd
moments "position objects" with very different X and Y coordinates.

This bug is most likely related to the `company-pseudo-tooltip-overlay'
now being positioned starting with the end of the current line (before
the newline), because if I add a space after the current point, I can't
reproduce it anymore. This was at one point suggested by Eli
(http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00328.html),
or at least hinted at.

I'd be happy to help debugging this further, if someone tells me how.

In GNU Emacs 24.3.93.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-09-05 on axl
Repository revision: 117482 address@hidden
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:     Ubuntu 14.04.1 LTS



--- End Message ---
--- Begin Message --- Subject: Re: bug#18504: 24.3.93; posn-at-point intermittently returns wrong value for a valid buffer position Date: Tue, 23 Sep 2014 22:39:49 +0400 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1
On 09/20/2014 11:13 AM, Eli Zaretskii wrote:

This happens when posn-at-point is called with the company-mode
overlay still (or already?) in place at that position.  That overlay
has the invisible property, so it hides the buffer text starting at
the position with which you call posn-at-point.  Therefore,
posn-at-point returns information about the first visible buffer
position after the overlay string.

I see, thanks. But does the fact that we get a different return value with different values of bidi-display-reordering, look right to you?

So I think you need to make sure inside company--col-row that the
overlay is popped down, before you call posn-at-point.  Evidently, in
some scenarios it isn't.

Yes, seems to be a bug with the way we set the "current" keymap when completion is performed (the popup is displayed only during that time). Thank you for confirming, I'm looking into it.

The buffer position returned by
posn-at-point can serve as your control variable: if it is different
from the position that is the argument to company--col-row, you have
this situation.

Ok. I can just directly check if the overlay has the `invisible' property set to t or not, though. We keep a reference to the overlay.


--- End Message ---

reply via email to

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