u8-line: Fix handling of double-width characters in u8_line_reserve().
commitbb2089cfd1bc7fcf50a3b7713508e8a057caf7be
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Apr 2024 16:14:43 +0000 (14 09:14 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Apr 2024 16:42:24 +0000 (14 09:42 -0700)
tree28effbc3004359684ef90433e621f9a878224125
parent0b8b85706437d0bb3466697cb22da13eacd51e70
u8-line: Fix handling of double-width characters in u8_line_reserve().

This code was terribly confusing.  This adds a little redundancy but it is
easier to understand.

This is difficult logic and more bugs may lurk.

Thanks to Zhou Geng for reporting this bug as poc13 in the report here:
https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html
src/libpspp/u8-line.c