Software /
code /
prosody
Comparison
util/human/io.lua @ 10910:e890b83f08cf
util.human.io: Consider separator when calculating remaining width
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 04 Jun 2020 18:40:37 +0200 |
parent | 10909:3af3354366eb |
child | 10911:9dc34e1556d9 |
comparison
equal
deleted
inserted
replaced
10909:3af3354366eb | 10910:e890b83f08cf |
---|---|
108 if not(type(width) == "string" and width:sub(-1) == "%") then | 108 if not(type(width) == "string" and width:sub(-1) == "%") then |
109 local title = col_specs[i].title; | 109 local title = col_specs[i].title; |
110 width = math.max(tonumber(width), title and (#title+1) or 0); | 110 width = math.max(tonumber(width), title and (#title+1) or 0); |
111 widths[i] = width; | 111 widths[i] = width; |
112 free_width = free_width - width; | 112 free_width = free_width - width; |
113 if i > 1 then | |
114 free_width = free_width - #separator; | |
115 end | |
113 end | 116 end |
114 end | 117 end |
115 -- Calculate width of %-based columns | 118 -- Calculate width of %-based columns |
116 for i = 1, #col_specs do | 119 for i = 1, #col_specs do |
117 if not widths[i] then | 120 if not widths[i] then |