ElasticTabstops
ElasticTabstops copied to clipboard
Add support for double-width characters
Fix SublimeText/ElasticTabstops#14
I hope it's obvious from the code, but what I did is:
- defined
column_widthfunction which takes into account wide characters; -
cell_widths_for_rowuses the above instead of plainlento properly calculate cell widths; -
adjust_rowfor the most part works as before, except thatdifferenceis re-synchronized inside the loop by column widths instead of character offsets. Unfortunately, this'll work slightly slower than before — but I didn't encounter any noticeable slowdown on my 10kiB TSV file with 10 columns.
And no changes beyond that, pretty simple in fact.
Sorry for the huge delay! Looks great. I had a couple quick comments. Thanks for the PR!