In vim 7.3, the strdisplaywidth function was added to give an accurate
count of the number of screen columns that will be taken up by a given
string. Tabular was written before vim 7.3, and was implementing this
functionality itself (at least for tabs; it wasn't trying to handle
doublewide characters).
This changeset allows us to take advantage of strdisplaywidth where it
exists.
The docs are updated to document this feature. Calling :Tabularize with
arguments and no previous pattern prints an error message and does
nothing. This works with both patterns and named commands.
Suggested by nocash - http://github.com/godlygeek/tabular/pull/2
The original implementation had some serious problems with delimiters
that were allowed to match with zero-width. This should correct
https://github.com/godlygeek/tabular/issues/3 - please let me know if
you find any regressions!
Per tpope:
"I just discovered the second of the two tabular fixes I gave you
doesn't work properly if the delimiter is at the very beginning of the
line... [It] pretended the leading whitespace was part of the padding,
which doesn't help if there's no leading whitespace."
This reverts commit 16f7b1e204.
The logic to clear a:lines and replace it with the return of the
function failed pretty miserably when the function returned a:lines. It
cleared a:lines and then replaced it with the (now empty) elements.