Software /
code /
prosody
Comparison
util/human/io.lua @ 10917:1eb83bc6f706
util.human.io: Fix right-alignment
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 06 Jun 2020 16:43:28 +0200 |
parent | 10911:9dc34e1556d9 |
child | 11892:e712133b4de1 |
comparison
equal
deleted
inserted
replaced
10916:c7ed8f754033 | 10917:1eb83bc6f706 |
---|---|
132 for i, column in ipairs(col_specs) do | 132 for i, column in ipairs(col_specs) do |
133 local width = widths[i]; | 133 local width = widths[i]; |
134 local v = (not titles and column.mapper or tostring)(row[not titles and column.key or i] or "", row); | 134 local v = (not titles and column.mapper or tostring)(row[not titles and column.key or i] or "", row); |
135 if #v < width then | 135 if #v < width then |
136 if column.align == "right" then | 136 if column.align == "right" then |
137 v = padleft(v, width-1).." "; | 137 v = padleft(v, width); |
138 else | 138 else |
139 v = padright(v, width); | 139 v = padright(v, width); |
140 end | 140 end |
141 elseif #v > width then | 141 elseif #v > width then |
142 v = v:sub(1, width-1) .. "…"; | 142 v = v:sub(1, width-1) .. "…"; |