diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-05-19 11:34:23 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-05-19 11:34:23 +0200 |
commit | 11058a713a3179e47ae24a583b2bf981b4a694b7 (patch) | |
tree | 3dab475ed2a7b768ac1507c792238d42e6115a15 | |
parent | 245b300a2eb7c43a68079081d54bd6cf82421691 (diff) | |
download | org-mode-11058a713a3179e47ae24a583b2bf981b4a694b7.tar.gz |
Fix alignment of numbers with invisible characters in tables
Bold numbers like *2.4* were aligned incorrectly in columns that have
mostly numbers.
Reported by Sebastian Rose
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org-table.el | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7cc28e4..5640c49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-05-19 Carsten Dominik <carsten.dominik@gmail.com> + + * org-table.el (org-table-align): Fix alignment of strings + with invisible characters. + 2010-05-17 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-refile-use-cache): New option. diff --git a/lisp/org-table.el b/lisp/org-table.el index 1763b54..13de670 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -629,7 +629,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|")) (hfmt1 (concat (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+")) - emptystrings links dates emph narrow falign falign1 fmax f1 len c e) + emptystrings links dates emph narrow + falign falign1 fmax f1 len c e space) (untabify beg end) (remove-text-properties beg end '(org-cwidth t org-dwidth t display t)) ;; Check if we have links or dates @@ -745,7 +746,11 @@ When nil, simply write \"#ERROR\" in corrupted fields.") (text-property-any 0 (length (car c)) 'invisible 'org-link (car c)) ; (string-match org-bracket-link-regexp (car c)) (< (org-string-width (car c)) len)) - (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ ))))))) + (progn + (setq space (make-string (- len (org-string-width (car c))) ?\ )) + (setcar c (if (nth i typenums) + (concat space (car c)) + (concat (car c) space)))))))) ;; Compute the formats needed for output of the table (setq rfmt (concat indent "|") hfmt (concat indent "|")) |