Henrik Hørlück Berg 6dd2cd2b20 Fix behaviour in the presence of non-visible width
Padding with an unprintable character is now disallowed, like it was for other
zero-length characters.

`string shorten` now ignores escape sequences and non-printable characters
when calculating the visible width of the ellipsis used (except for `\b`,
which is treated as a width of -1).
Previously `fish_wcswidth` returned a length of -1 when the ellipsis-str
contained any non-printable character, causing the command to poentially
print a larger width than expected.

This also fixes an integer overflows in `string shorten`'s
`max` and `max2`, when the cumulative sum of character widths turned negative
(e.g. with any non-printable characters, or `\b` after the changes above).
The overflow potentially caused strings containing non-printable characters
to be truncated.

This adds test that verify the fixed behaviour.
2023-07-27 22:00:03 -07:00
..
2023-07-27 22:00:03 -07:00
2022-08-12 18:38:47 +02:00
2022-06-27 17:50:40 +02:00
2020-02-08 13:30:48 +01:00
2019-06-26 21:19:40 +02:00
2020-01-19 15:07:06 +01:00
2022-08-12 18:38:47 +02:00
2022-11-15 19:05:18 +01:00
2022-05-17 17:21:42 +02:00
2020-12-29 12:48:11 +01:00
2022-10-09 15:24:01 +02:00
2022-08-12 18:38:47 +02:00
2023-04-17 17:28:24 +02:00
2022-08-12 18:38:47 +02:00
2023-06-24 21:26:44 +02:00
2022-10-05 17:25:00 +02:00
2023-02-19 21:01:46 +01:00
2023-01-13 17:56:28 +01:00
2022-07-18 20:45:30 +02:00
2022-08-12 18:38:47 +02:00
2019-07-09 10:02:50 -07:00
2021-06-24 18:17:10 +02:00
2021-06-24 20:46:03 +02:00
2022-08-12 18:38:47 +02:00
2022-12-22 17:34:10 +01:00
2022-09-21 18:37:38 +02:00
2022-08-12 18:38:47 +02:00
2023-05-11 22:14:12 +02:00
2023-04-16 11:27:08 +02:00
2022-03-24 10:23:04 +08:00
2020-03-16 21:21:10 +01:00