ox-ascii: Convert `length' to `string-width'
commitb7c1014353241d8cfe1bfe8094a8932da37860d6
authorYasushi SHOJI <yashi@atmark-techno.com>
Thu, 16 Jan 2014 15:09:30 +0000 (16 16:09 +0100)
committerNicolas Goaziou <n.goaziou@gmail.com>
Thu, 16 Jan 2014 15:17:48 +0000 (16 16:17 +0100)
treebe5a3507e8945b1aeecf2e66975281cda5082c5c
parent7d3205a20f5c0fc58754e78f5a2afa45ba6446d0
ox-ascii: Convert `length' to `string-width'

* lisp/ox-ascii.el (org-ascii--current-text-width): Convert `length'
  to `string-width'.
  (org-ascii--build-title, org-ascii--build-toc)
  (org-ascii--list-listings, org-ascii--list-tables)
  (org-ascii-template--document-title)
  (org-ascii-inner-template, org-ascii-format-inlinetask-default)
  (org-ascii-format-inlinetask-default, org-ascii-item
  (org-ascii--table-cell-width, org-ascii-table-cell)
  (org-ascii--current-text-width): Likewise.

I've checked all occurrences of the function `length' in ox-ascii.el.
It turns out that the most of them are calculating the width of given
string.  To support fullwidth characters, we better use `string-width'
instead of `length'.

Some characters in UCS are categorized as "East Asian Ambiguous"[1].
The return value of `string-width' with those characters depends on
how Emacs is setup.  We leave those ambiguous character handling to
Emacs.

Two usages of `length' in `ox-ascii.el' were left as-is, because those
were used for:

 - bullet depth calculation in `org-ascii-headline', and
 - cell position calculation in `org-ascii--table-cell-width'.

[1]: http://www.unicode.org/reports/tr11/#Ambiguous
lisp/ox-ascii.el