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

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

bug#31966: 27.0.50; auto-complete candidates aren't aligned properly


From: John Shahid
Subject: bug#31966: 27.0.50; auto-complete candidates aren't aligned properly
Date: Mon, 25 Jun 2018 19:10:45 +0000
User-agent: mu4e 1.1.0; emacs 27.0.50

Eli Zaretskii <eliz@gnu.org> writes:

> tags 31966 notabug
> thanks
>
>> From: John Shahid <jvshahid@gmail.com>
>> Date: Mon, 25 Jun 2018 17:08:50 +0000
>>
>> The candidates in the auto-complete popup aren't aligned properly. The
>> left margin appears to be shifted to the right relative to the
>> point. This seems to be caused by `vertical-motion' behavior changing on
>> master.
>>
>> when display-line-numbers is turned on I expect the following to move
>> the point to the following line while keeping the point's column fixed
>> (assuming of course that the following line is long enough):
>>
>>   (vertical-motion (cons (car (posn-col-row (posn-at-point))) 1))
>>
>> This isn't the case anymore with current master. Point will move to the
>> right by the number of characters used to display the line numbers.
>
> (The emacs-26 branch behaves like master now, btw.)
>
> This is not a bug.  posn-at-point doesn't measure columns, it measures
> the X coordinate relative to the window edge, and just expresses it in
> columns, so the result includes the width taken by the line-number
> display.  If you need to get at the column number relative to the
> leftmost text character, use current-column.  And if you want the
> result in canonical columns, i.e. in units of width of the frame's
> default face's font (as opposed to the font used by buffer text near
> point), then subtract from what posn-at-point returns the value
> returned by the following function call:
>
>   (line-number-display-width 'columns)

Thanks for the explanation. I opened a PR on the popup-el github
repository https://github.com/auto-complete/popup-el/pull/116. The PR
does something similar to the following

     (if (functionp 'line-number-display-width) (setq column ...))

is that an acceptable approach or should I use the emacs-major-version
instead ?

>
> The code you show used to work because there was a bug which masked
> this issue, and that bug is now fixed on both master and the emacs-26
> branch.

I read the emacs-26 NEWS file and all of this is making more sense now.

>
> Thanks.





reply via email to

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