Mercurial > prosody-hg
diff util/human/io.lua @ 13067:386ca97bec5b
util.human.io: Fix error with ellipsis to negative length
Can happen if you resize the terminal too narrow that the space left for
variable width columns end up negative.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 09 Apr 2023 01:34:08 +0200 |
| parents | f4d7fe919969 |
| children | 7a75cbc4d87c |
line wrap: on
line diff
--- a/util/human/io.lua Sat Apr 08 12:56:13 2023 +0200 +++ b/util/human/io.lua Sun Apr 09 01:34:08 2023 +0200 @@ -123,7 +123,7 @@ local function ellipsis(s, width) if len(s) <= width then return s; end - if width == 1 then return "…"; end + if width <= 1 then return "…"; end return utf8_cut(s, width - 1) .. "…"; end
