util.human.io: Fix error with ellipsis to negative length
authorKim Alvefur <zash@zash.se>
Sun, 09 Apr 2023 01:34:08 +0200
changeset 13071 386ca97bec5b
parent 13070 4aa4a51a7a77
child 13072 7a75cbc4d87c
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.
util/human/io.lua
--- 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