Re: [PATCH 1/3 v2] Limit width of formatted text by characters rather than bytes
Will Storey <[email protected]> Mon, 18 Sep 2017 20:03:08 -0700
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun 2017-09-17 21:31:08 +0200, Jeremie Courreges-Anglas wrote: > Actually the behavior was rather incorrect. After my patch, > concat_width was copying up to 'width' bytes, not up to 'width' UTF-8 > characters. This gotcha was caught by your test case. I find the > latter behavior more useful. > > Note that the function only cares about how many characters we concat, > not about their actual width on screen. I believe this behavior is > reasonable, though. Sounds good to me! > > Anyway, I think it is a big improvement as is. > > > > It also still might be good to have a few unit tests. Would you be okay > > with tests in the form of my third patch? > > Yep. I have applied your 3/3 patch, which introduces a testcase, and > made further tweaks. Namely: > - rename concat_width to something more appropriate > - move it so sbuf.c > - shuffled some code to make it easier to link against it > - move the testcase to its own .c file > - simplify src/Makefile.am accordingly > > Feedback welcome. It looks great. Thank you for getting that in!