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
commitd2f09cb37f8cadb2a6de205b93a7e9c80d29c5d2 (patch)
tree708398cff34e9be87b2ee45643d1292d6fe29b3b /util
parent6bcf492c34189308db20ff64e344f823e341aa77 (diff)
downloadprosody-d2f09cb37f8cadb2a6de205b93a7e9c80d29c5d2.tar.gz
prosody-d2f09cb37f8cadb2a6de205b93a7e9c80d29c5d2.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