GNU bug report logs - #27427
26.0.50; Native line numbers lead to display error in company-mode popup

Previous Next

Package: emacs;

Reported by: Alexander Miller <alexanderm <at> web.de>

Date: Mon, 19 Jun 2017 16:51:02 UTC

Severity: normal

Found in version 26.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #278 received at 27427 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: alexanderm <at> web.de, 27427 <at> debbugs.gnu.org
Subject: Re: bug#27427: 26.0.50; Native line numbers lead to display error in
 company-mode popup
Date: Fri, 14 Jul 2017 02:04:21 +0300
On 6/26/17 1:56 AM, Dmitry Gutov wrote:
> On 6/25/17 8:57 PM, Eli Zaretskii wrote:
> 
>> Should be fixed now.
> 
> Thanks, both cases are working well now.

...and either something changed before the merge into master, or I 
tested the result poorly. Probably the latter.

What doesn't work well is that the popup "background" gets displaced to 
the left by the width of the numbers column, when rendered using the 
popup overlay. Background meaning the contents of all the lines behind 
the popup. And that happens because the line number glyphs are gone for 
those specific lines, and we can't pad them without knowing the width of 
the numbers column.

Now, I've come upon this idea of a trivial patch. What do you think, 
Eli? It seems to work perfectly, even though I'm struggling to 
understand how this might happen under the covers. Is it brittle?

We bind display-line-numbers to nil around the call to posn-at-point, so 
that it calculates the column value that we want. I imagine there's some 
extra redisplay work involved, but it still turns out to be faster than 
calling posn-at-point twice.

diff --git a/company.el b/company.el
index f361bb7..869c5de 100644
--- a/company.el
+++ b/company.el
@@ -835,7 +835,8 @@ means that `company-mode' is always turned on except 
in `message-mode' buffers."
     (cons (+ col (window-hscroll)) row)))

 (defun company--col-row (&optional pos)
-  (company--posn-col-row (posn-at-point pos)))
+  (let (display-line-numbers)
+    (company--posn-col-row (posn-at-point pos))))

 (defun company--row (&optional pos)
   (cdr (company--col-row pos)))




This bug report was last modified 7 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.