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: Eli Zaretskii
Subject: bug#31966: 27.0.50; auto-complete candidates aren't aligned properly
Date: Mon, 25 Jun 2018 20:27:52 +0300

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)

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.

Thanks.





reply via email to

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