aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-04 18:32:33 +0200
committerKim Alvefur <zash@zash.se>2020-06-04 18:32:33 +0200
commit435cd193730136205057c8cbed1c4095573303eb (patch)
tree708398cff34e9be87b2ee45643d1292d6fe29b3b /util
parentad3d04768583786fdbf595f901e832c040afa038 (diff)
downloadprosody-435cd193730136205057c8cbed1c4095573303eb.tar.gz
prosody-435cd193730136205057c8cbed1c4095573303eb.zip
util.human.io: Replace overflow with ellipsis
Diffstat (limited to 'util')
-rw-r--r--util/human/io.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/human/io.lua b/util/human/io.lua
index 0f0c9155..389ed25a 100644
--- a/util/human/io.lua
+++ b/util/human/io.lua
@@ -128,13 +128,15 @@ local function new_table(col_specs, max_width)
local output = {};
for i, column in ipairs(col_specs) do
local width = widths[i];
- local v = tostring(row[not titles and column.key or i] or ""):sub(1, width);
+ local v = tostring(row[not titles and column.key or i] or "");
if #v < width then
if column.align == "right" then
v = padleft(v, width-1).." ";
else
v = padright(v, width);
end
+ elseif #v > width then
+ v = v:sub(1, width-1) .. "\u{2026}";
end
table.insert(output, v);
end