forked from mirrors/org-mode
org-table: Fix shrunk columns on hlines
* lisp/org-table.el (org-table--shrunk-field): Fix function when on a hline. * testing/lisp/test-org-table.el (test-org-table/shrunk-columns): Add tests. Reported-by: Kaushal Modi <kaushal.modi@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00231.html>
This commit is contained in:
parent
af824a9b39
commit
58da7d4d17
|
@ -3842,7 +3842,9 @@ When non-nil, return the overlay narrowing the field."
|
||||||
(and (eq 'table-column-hide (overlay-get o 'org-overlay-type))
|
(and (eq 'table-column-hide (overlay-get o 'org-overlay-type))
|
||||||
o))
|
o))
|
||||||
(overlays-at (save-excursion
|
(overlays-at (save-excursion
|
||||||
(skip-chars-forward "^|" (line-end-position))
|
(skip-chars-forward (if (org-at-table-hline-p) "^+|"
|
||||||
|
"^|")
|
||||||
|
(line-end-position))
|
||||||
(1- (point))))))
|
(1- (point))))))
|
||||||
|
|
||||||
(defun org-table--list-shrunk-columns ()
|
(defun org-table--list-shrunk-columns ()
|
||||||
|
|
|
@ -2591,7 +2591,45 @@ See also `test-org-table/copy-field'."
|
||||||
(org-table-toggle-column-width)
|
(org-table-toggle-column-width)
|
||||||
(org-table-get-field nil "b")
|
(org-table-get-field nil "b")
|
||||||
(mapcar (lambda (o) (overlay-get o 'help-echo))
|
(mapcar (lambda (o) (overlay-get o 'help-echo))
|
||||||
(overlays-in (point-min) (point-max)))))))
|
(overlays-in (point-min) (point-max))))))
|
||||||
|
;; Moving to next field doesn't change shrunk state.
|
||||||
|
(should
|
||||||
|
(equal "a"
|
||||||
|
(org-test-with-temp-text "| <point>a | b |"
|
||||||
|
(org-table-toggle-column-width)
|
||||||
|
(org-table-next-field)
|
||||||
|
(overlay-get (car (overlays-at (1+ (line-beginning-position))))
|
||||||
|
'help-echo))))
|
||||||
|
(should
|
||||||
|
(equal "b"
|
||||||
|
(org-test-with-temp-text "| a | <point>b |"
|
||||||
|
(org-table-toggle-column-width)
|
||||||
|
(goto-char 2)
|
||||||
|
(org-table-next-field)
|
||||||
|
(overlay-get (car (overlays-at (point))) 'help-echo))))
|
||||||
|
;; Aligning table doesn't alter shrunk state.
|
||||||
|
(should
|
||||||
|
(equal "a"
|
||||||
|
(org-test-with-temp-text "| <point>a | b |"
|
||||||
|
(org-table-toggle-column-width)
|
||||||
|
(org-table-align)
|
||||||
|
(overlay-get (car (overlays-at (1+ (line-beginning-position))))
|
||||||
|
'help-echo))))
|
||||||
|
(should
|
||||||
|
(equal "b"
|
||||||
|
(org-test-with-temp-text "|---+-----|\n| a | <point>b |"
|
||||||
|
(org-table-toggle-column-width)
|
||||||
|
(org-table-align)
|
||||||
|
(overlay-get (car (overlays-at (point)))
|
||||||
|
'help-echo))))
|
||||||
|
(should
|
||||||
|
(equal
|
||||||
|
'("b")
|
||||||
|
(org-test-with-temp-text "|---+-----|\n| a | <point>b |"
|
||||||
|
(org-table-toggle-column-width)
|
||||||
|
(org-table-align)
|
||||||
|
(mapcar (lambda (o) (overlay-get o 'help-echo))
|
||||||
|
(overlays-in (line-beginning-position) (line-end-position)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue