org-table.el: Fix a bug when displaying a table header

* lisp/org-table.el (org-table-row-get-visible-string): Fix wrong
beginning of the header string.
(org-table-header-set-header): Get the real beginning of the line.

Reported-by: "Oorja Sandhu" <oorja.sandhu@inoutbox.com>
Link: https://orgmode.org/list/7beea3b5-6fe5-4ba6-831e-19a88d87de6b@www.fastmail.com/
This commit is contained in:
Bastien Guerry 2021-04-26 21:51:12 +02:00
parent 29d21ea628
commit 058339d6e6
1 changed files with 3 additions and 2 deletions

View File

@ -461,13 +461,14 @@ This may be useful when columns have been shrunk."
(when pos (goto-char pos))
(goto-char (line-beginning-position))
(let ((end (line-end-position)) str)
(backward-char)
(while (progn (forward-char 1) (< (point) end))
(let ((ov (car (overlays-at (point)))))
(if (not ov)
(push (char-to-string (char-after)) str)
(push (overlay-get ov 'display) str)
(goto-char (1- (overlay-end ov))))))
(format "|%s" (mapconcat #'identity (reverse str) "")))))
(format "%s" (mapconcat #'identity (reverse str) "")))))
(defvar-local org-table-header-overlay nil)
(defun org-table-header-set-header ()
@ -483,7 +484,7 @@ This may be useful when columns have been shrunk."
(while (or (org-at-table-hline-p)
(looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>"))
(move-beginning-of-line 2))
(point)))
(line-beginning-position)))
(end (save-excursion (goto-char beg) (point-at-eol))))
(if (pos-visible-in-window-p beg)
(when (overlayp org-table-header-overlay)