Make header line in some modes be sensitive to display-line-numbers

* lisp/ruler-mode.el (ruler-mode-ruler, ruler-mode-window-col):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header)
(tabulated-list-print-entry): Account for the width taken by
line-number display.  (Bug#27895)
This commit is contained in:
Eli Zaretskii 2017-08-05 14:22:04 +03:00
parent 885c512603
commit c3ac93bb9f
2 changed files with 18 additions and 3 deletions

View file

@ -194,6 +194,8 @@ Populated by `tabulated-list-init-header'.")
mouse-face highlight
keymap ,tabulated-list-sort-button-map))
(cols nil))
(if display-line-numbers
(setq x (+ x (line-number-display-width) 2)))
(push (propertize " " 'display `(space :align-to ,x)) cols)
(dotimes (n (length tabulated-list-format))
(let* ((col (aref tabulated-list-format n))
@ -410,6 +412,8 @@ of column descriptors."
(x (max tabulated-list-padding 0))
(ncols (length tabulated-list-format))
(inhibit-read-only t))
(if display-line-numbers
(setq x (+ x (line-number-display-width) 2)))
(if (> tabulated-list-padding 0)
(insert (make-string x ?\s)))
(let ((tabulated-list--near-rows ; Bind it if not bound yet (Bug#25506).