ElasticTabstops icon indicating copy to clipboard operation
ElasticTabstops copied to clipboard

Add support for double-width characters

Open ulidtko opened this issue 10 years ago • 2 comments

Fix SublimeText/ElasticTabstops#14

ulidtko avatar Oct 23 '15 16:10 ulidtko

I hope it's obvious from the code, but what I did is:

  • defined column_width function which takes into account wide characters;
  • cell_widths_for_row uses the above instead of plain len to properly calculate cell widths;
  • adjust_row for the most part works as before, except that difference is 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.

ulidtko avatar Oct 23 '15 16:10 ulidtko

Sorry for the huge delay! Looks great. I had a couple quick comments. Thanks for the PR!

adzenith avatar Dec 17 '15 02:12 adzenith