On 25. 5. 26 08:25, Timofei Zhakov wrote:
Hello all and Branko,

I misunderstood your original comment and was quite sad because I recognised offense in it. I was doing my best to implement something I thought was an interesting idea with no potential regression only to realise that it broke everything. I took it personally and got upset.

I should take a step back. It also turned out it wasn't as obvious as I thought. There are much more pitfalls than I expected.

To be clear: I believe reviews, feedback, comments, frustrations of something being broken, discussions, suggestions, nitpicks, etc. - all of that *is* important for a healthy community.

I'm sorry and I'd be happy to switch the conversation back on topic.

Thank you. No hard feelings.

So back on topic: in the meantime I reimplemented the string trimming and alignment functions so that they're aware or grapheme boundaries. Predictably, all existing tests passed except the one that was trying to squeeze a two-column emoji into a one-column space. I adjusted the expected result for that one because IMO respecting the column width is more important than printing "something" that ends up misaligned. We can discuss how to handle that remote edge case – we could even print a replacement mark.

I also added some handling of invalid UTF-8, so that the align functions always return something of the expected width.

If you have time and interest, I wouldn't mind if another pair of eyes took a look at that code.


On the topic of glyph widths, there is one case that we do not handle: some glyphs do not have a predictable width, it can vary with the font, even if monospaced. Even the replacement mark is one of those, where in some East Asian contexts it can be two columns wide instead of one. Utf8proc has a function that tells if codepoint has ambiguous width, but I really don't know how we could even handle that; Subversion isn't a general text processor and knows nothing of fonts or Unicode regional contexts. So I propose that we simply ignore this issue. If and when somebody notices it, we can attempt a fix – but we'd (or at least I would) need some expert help in this area.


-- Brane

Reply via email to