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

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

bug#27427: 26.0.50; Native line numbers lead to display error in company


From: Dmitry Gutov
Subject: 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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Thunderbird/54.0

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?





reply via email to

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