reopen 360427
thanks

Hello Ludovic,

your 50_utf8-more.patch did hide this bug well, but it is not a proper fix. Testcase: shrink your terminal to 62 columns and select 642,983,488 bytes in 157 files. You will get: "642,983,488 байт в 157 <D1>". Note that the complete string "642,983,488 байт в 157 файлах" would still just fit.

The bug is that

1) one can't poke a zero byte into an arbitrary place of a multibyte string while conserving its validity.

2) the intention is to zero the character at the "cols" position, not the "cols" byte.

Instead of blindly poking a zero at the "cols", you have to iterate through all characters from the beginning of the buffer, and zero the first byte of the first character that doesn't fit in "cols" cells.

--
Alexander E. Patrakov

Reply via email to