all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
@ 2020-06-25 13:29 Dmitry Gutov
  2020-06-25 14:18 ` Dmitry Gutov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dmitry Gutov @ 2020-06-25 13:29 UTC (permalink / raw
  To: 42039

1. Enable display-line-numbers-mode.
2. Move point to the beginning of some line.
3. Evaluate (posn-x-y (posn-at-point))

=> The value in CAR will be > 0 (to account for the columns taken by 
d-l-n-m).

4. Do the same thing on a line that belongs to an overlay. For example,
the overlay in the bug reporting buffer (move point to the line with
"This bug report...").
5. The return value will be like (0 . 180).

The expected behavior: the column should still account for the offset by
the d-l-n-m.

I'd really like to see this fixed in Emacs, it makes positioning of
popups unpredictable when display-line-numbers-mode is enabled: 
https://github.com/company-mode/company-quickhelp/issues/106





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-25 13:29 bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode Dmitry Gutov
@ 2020-06-25 14:18 ` Dmitry Gutov
  2020-06-25 17:42 ` Eli Zaretskii
  2020-06-26 12:04 ` Eli Zaretskii
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2020-06-25 14:18 UTC (permalink / raw
  To: 42039

Sorry,

On 25.06.2020 16:29, Dmitry Gutov wrote:
> 
> I'd really like to see this fixed in Emacs, it makes positioning of

                                     ^ in Emacs 27





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-25 13:29 bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode Dmitry Gutov
  2020-06-25 14:18 ` Dmitry Gutov
@ 2020-06-25 17:42 ` Eli Zaretskii
  2020-06-25 18:35   ` Dmitry Gutov
  2020-06-26 12:04 ` Eli Zaretskii
  2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2020-06-25 17:42 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 42039

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Thu, 25 Jun 2020 16:29:21 +0300
> 
> 1. Enable display-line-numbers-mode.
> 2. Move point to the beginning of some line.
> 3. Evaluate (posn-x-y (posn-at-point))
> 
> => The value in CAR will be > 0 (to account for the columns taken by 
> d-l-n-m).
> 
> 4. Do the same thing on a line that belongs to an overlay. For example,
> the overlay in the bug reporting buffer (move point to the line with
> "This bug report...").
> 5. The return value will be like (0 . 180).

The bug-report buffer doesn't use an overlay, it uses a display
property string.  Do you have an example with an overlay where this
problem happens, or is it limited to display strings?





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-25 17:42 ` Eli Zaretskii
@ 2020-06-25 18:35   ` Dmitry Gutov
  2020-06-25 19:13     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2020-06-25 18:35 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: 42039

On 25.06.2020 20:42, Eli Zaretskii wrote:
> The bug-report buffer doesn't use an overlay, it uses a display
> property string.  Do you have an example with an overlay where this
> problem happens, or is it limited to display strings?

Good question. It doesn't happen with just any overlay, so here's a full 
example:

1. Create an overlay, e.g.

(setq o (make-overlay (point) (1+ (point))))

The buffer contents seem unimportant. It can cover some text, or a 
newline, or multiple lines. But it should start at bol (if it doesn't 
start at bol, the result will also be unexpected, but not 0).

So the buffer text can just be a bunch of newlines, for the sake of this 
example.

2. Put a display string on it that (important!) ends with a newline:

(overlay-put o 'display "abc\ndef\n")

3. Eval

(car (posn-x-y (posn-at-point (overlay-start o))))

It will evaluate to 0 even if display-line-numbers-mode is enabled.





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-25 18:35   ` Dmitry Gutov
@ 2020-06-25 19:13     ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2020-06-25 19:13 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 42039

> Cc: 42039@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Thu, 25 Jun 2020 21:35:59 +0300
> 
> 2. Put a display string on it that (important!) ends with a newline:
> 
> (overlay-put o 'display "abc\ndef\n")
> 
> 3. Eval
> 
> (car (posn-x-y (posn-at-point (overlay-start o))))
> 
> It will evaluate to 0 even if display-line-numbers-mode is enabled.

So this _is_ triggered only by display strings.  Thanks.





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-25 13:29 bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode Dmitry Gutov
  2020-06-25 14:18 ` Dmitry Gutov
  2020-06-25 17:42 ` Eli Zaretskii
@ 2020-06-26 12:04 ` Eli Zaretskii
  2020-06-26 12:55   ` Dmitry Gutov
  2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2020-06-26 12:04 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 42039

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Thu, 25 Jun 2020 16:29:21 +0300
> 
> 1. Enable display-line-numbers-mode.
> 2. Move point to the beginning of some line.
> 3. Evaluate (posn-x-y (posn-at-point))
> 
> => The value in CAR will be > 0 (to account for the columns taken by 
> d-l-n-m).
> 
> 4. Do the same thing on a line that belongs to an overlay. For example,
> the overlay in the bug reporting buffer (move point to the line with
> "This bug report...").
> 5. The return value will be like (0 . 180).
> 
> The expected behavior: the column should still account for the offset by
> the d-l-n-m.
> 
> I'd really like to see this fixed in Emacs, it makes positioning of
> popups unpredictable when display-line-numbers-mode is enabled: 
> https://github.com/company-mode/company-quickhelp/issues/106

Your wish has been granted: this should now be fixed on the emacs-27
branch.





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-26 12:04 ` Eli Zaretskii
@ 2020-06-26 12:55   ` Dmitry Gutov
  2020-06-26 13:37     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2020-06-26 12:55 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: 42039

On 26.06.2020 15:04, Eli Zaretskii wrote:
>> From: Dmitry Gutov <dgutov@yandex.ru>
>> Date: Thu, 25 Jun 2020 16:29:21 +0300
>>
>> 1. Enable display-line-numbers-mode.
>> 2. Move point to the beginning of some line.
>> 3. Evaluate (posn-x-y (posn-at-point))
>>
>> => The value in CAR will be > 0 (to account for the columns taken by
>> d-l-n-m).
>>
>> 4. Do the same thing on a line that belongs to an overlay. For example,
>> the overlay in the bug reporting buffer (move point to the line with
>> "This bug report...").
>> 5. The return value will be like (0 . 180).
>>
>> The expected behavior: the column should still account for the offset by
>> the d-l-n-m.
>>
>> I'd really like to see this fixed in Emacs, it makes positioning of
>> popups unpredictable when display-line-numbers-mode is enabled:
>> https://github.com/company-mode/company-quickhelp/issues/106
> 
> Your wish has been granted: this should now be fixed on the emacs-27
> branch.

Thank you.

It's working fine now in the cases I really care about (so we can close 
the report), but here's one you seem to have missed:

1. M-x report-emacs-bug.
2. Toggle display-line-numbers-mode on.
3. Move point to the second display string ("If Emacs crashed...").
4. Evaluate (posn-x-y (posn-at-point)).





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-26 12:55   ` Dmitry Gutov
@ 2020-06-26 13:37     ` Eli Zaretskii
  2020-06-26 16:00       ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2020-06-26 13:37 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 42039

> Cc: 42039@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Fri, 26 Jun 2020 15:55:31 +0300
> 
> > Your wish has been granted: this should now be fixed on the emacs-27
> > branch.
> 
> Thank you.
> 
> It's working fine now in the cases I really care about (so we can close 
> the report), but here's one you seem to have missed:
> 
> 1. M-x report-emacs-bug.
> 2. Toggle display-line-numbers-mode on.
> 3. Move point to the second display string ("If Emacs crashed...").
> 4. Evaluate (posn-x-y (posn-at-point)).

It worked in a previous version of the fix, but then I decided to be
over-cautious...

Fixed.





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

* bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode
  2020-06-26 13:37     ` Eli Zaretskii
@ 2020-06-26 16:00       ` Dmitry Gutov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2020-06-26 16:00 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: 42039-done

On 26.06.2020 16:37, Eli Zaretskii wrote:
> It worked in a previous version of the fix, but then I decided to be
> over-cautious...
> 
> Fixed.

Thanks!

Looking good now.





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

end of thread, other threads:[~2020-06-26 16:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-25 13:29 bug#42039: 27.0.91; (posn-x-y (posn-at-point)) inconsistent with display-line-numbers-mode Dmitry Gutov
2020-06-25 14:18 ` Dmitry Gutov
2020-06-25 17:42 ` Eli Zaretskii
2020-06-25 18:35   ` Dmitry Gutov
2020-06-25 19:13     ` Eli Zaretskii
2020-06-26 12:04 ` Eli Zaretskii
2020-06-26 12:55   ` Dmitry Gutov
2020-06-26 13:37     ` Eli Zaretskii
2020-06-26 16:00       ` Dmitry Gutov

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.