0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:37:50 +00:00

org-colview: Fix out of range error when hscroll is greater than header

* lisp/org-colview.el (org-columns-hscroll-title): Fix out of range
  error when hscroll is greater than header.
This commit is contained in:
Nicolas Goaziou 2019-03-21 22:15:04 +01:00
parent 719887958d
commit 0ff705fac7

View file

@ -482,13 +482,15 @@ for the duration of the command.")
(defun org-columns-hscroll-title () (defun org-columns-hscroll-title ()
"Set the `header-line-format' so that it scrolls along with the table." "Set the `header-line-format' so that it scrolls along with the table."
(sit-for .0001) ; need to force a redisplay to update window-hscroll (sit-for .0001) ; need to force a redisplay to update window-hscroll
(when (not (= (window-hscroll) org-columns-previous-hscroll)) (let ((hscroll (window-hscroll)))
(setq header-line-format (when (/= org-columns-previous-hscroll hscroll)
(concat (substring org-columns-full-header-line-format 0 1) (setq header-line-format
(substring org-columns-full-header-line-format (concat (substring org-columns-full-header-line-format 0 1)
(1+ (window-hscroll)))) (substring org-columns-full-header-line-format
org-columns-previous-hscroll (window-hscroll)) (min (length org-columns-full-header-line-format)
(force-mode-line-update))) (1+ hscroll))))
org-columns-previous-hscroll hscroll)
(force-mode-line-update))))
(defvar org-colview-initial-truncate-line-value nil (defvar org-colview-initial-truncate-line-value nil
"Remember the value of `truncate-lines' across colview.") "Remember the value of `truncate-lines' across colview.")