Software /
code /
prosody
Changeset
10908:18dc4639442e
util.human.io: Replace overflow with ellipsis
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 04 Jun 2020 18:32:33 +0200 |
parents | 10907:6af28c756752 |
children | 10909:3af3354366eb |
files | util/human/io.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/human/io.lua Thu Jun 04 18:31:50 2020 +0200 +++ b/util/human/io.lua Thu Jun 04 18:32:33 2020 +0200 @@ -128,13 +128,15 @@ 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