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 #122 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: Mon, 26 Jun 2017 01:56:28 +0300
On 6/25/17 8:57 PM, Eli Zaretskii wrote:

> Should be fixed now.

Thanks, both cases are working well now. See below for the third one 
(though it's relatively rare). ;-(

> the fix only works for empty overlays at EOB,
> but that should be enough, right?  Or do you see some other way of
> specifying this property at EOB?

No, it seems plenty enough for me. I doubt we'd ever going to try using 
text properties for the popup without an overlay.

The third case which disrupts popup positioning: horizontal scrolling, 
which we discussed earlier. With native numbers, it breaks our function 
which calculates the "usable" window body width. It looks like this:

(defun company--window-width ()
  (let ((ww (window-body-width)))
    ;; Account for the line continuation column.
    (when (zerop (cadr (window-fringes)))
      (cl-decf ww))
    (unless (or (display-graphic-p)
                (version< "24.3.1" emacs-version))
      ;; Emacs 24.3 and earlier included margins
      ;; in window-width when in TTY.
      (cl-decf ww
               (let ((margins (window-margins)))
                 (+ (or (car margins) 0)
                    (or (cdr margins) 0)))))
    (when (and word-wrap
               (version< emacs-version "24.4.51.5"))
      ;; http://debbugs.gnu.org/19300
      (cl-decf ww))
    ;; whitespace-mode with newline-mark
    (when (and buffer-display-table
               (aref buffer-display-table ?\n))
      (cl-decf ww (1- (length (aref buffer-display-table ?\n)))))
    ww))

Without going into details, how do I figure out the width which line 
number glyphs are taking up? Any way to do that without calling 
posn-at-point at the beginning-of-visual-line?




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.