diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-03-21 22:15:04 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-03-21 22:15:04 +0100 |
commit | 0ff705fac71c0e7f20c0c7b41fd7ea2a546bf477 (patch) | |
tree | 82ee19e5cc50e9aa8a877967f28255fc2e38e1ce | |
parent | 719887958dafd67a3af7355bd3caafe694660e87 (diff) | |
download | org-mode-0ff705fac71c0e7f20c0c7b41fd7ea2a546bf477.tar.gz |
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.
-rw-r--r-- | lisp/org-colview.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 5001def..7f2a886 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -482,13 +482,15 @@ for the duration of the command.") (defun org-columns-hscroll-title () "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 - (when (not (= (window-hscroll) org-columns-previous-hscroll)) - (setq header-line-format - (concat (substring org-columns-full-header-line-format 0 1) - (substring org-columns-full-header-line-format - (1+ (window-hscroll)))) - org-columns-previous-hscroll (window-hscroll)) - (force-mode-line-update))) + (let ((hscroll (window-hscroll))) + (when (/= org-columns-previous-hscroll hscroll) + (setq header-line-format + (concat (substring org-columns-full-header-line-format 0 1) + (substring org-columns-full-header-line-format + (min (length org-columns-full-header-line-format) + (1+ hscroll)))) + org-columns-previous-hscroll hscroll) + (force-mode-line-update)))) (defvar org-colview-initial-truncate-line-value nil "Remember the value of `truncate-lines' across colview.") |