summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-18 17:03:56 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-18 17:03:56 +0100
commit7b951e6ebe673646de380178bd6904f1d17b765c (patch)
treed5309eb23ca4077a72c4225bafc15ac8891197ca
parenta7cf12feb57cc78fbf62553e3888b633b68ae34c (diff)
parentd64704343120992819c7aa8e1b4b78e35718419d (diff)
downloadorg-mode-7b951e6ebe673646de380178bd6904f1d17b765c.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-table.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el
index b6354a0..c4ad527 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4010,14 +4010,21 @@ the column again.
Return a list of overlays hiding the field, or nil if field is
already hidden."
(cond
- ((org-table--shrunk-field) nil) ;already shrunk: bail out
- ((or (= 0 width) ;shrink to one character
- (>= 1 (org-string-width (buffer-substring start end))))
+ ((= start end) nil) ;no field to narrow
+ ((org-table--shrunk-field) nil) ;already shrunk
+ ((= 0 width) ;shrink to one character
(list (org-table--make-shrinking-overlay
start end "" (if (eq 'hline contents) "" contents))))
- ((eq contents 'hline) ;no contents to hide
+ ((eq contents 'hline)
(list (org-table--make-shrinking-overlay
- start end (make-string (max 0 (1+ width)) ?-) "")))
+ start end (make-string (1+ width) ?-) "")))
+ ((equal contents "") ;no contents to hide
+ (list
+ (let ((w (org-string-width (buffer-substring start end))))
+ (if (> width w)
+ (org-table--make-shrinking-overlay
+ (1- end) end (make-string (- (+ width 2) w) ?\s) "")
+ (org-table--make-shrinking-overlay (- end (- w width 1)) end "" "")))))
(t
;; If the field is not empty, display exactly WIDTH characters.
;; It can mean to partly hide the field, or extend it with virtual