diff options
author | Matthew Wild <mwild1@gmail.com> | 2023-04-06 15:03:45 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2023-04-06 15:03:45 +0100 |
commit | 7e50781f519fcad5c33b570e1996a8026841adc3 (patch) | |
tree | 98667f58a54324cc65365bef580dd60f989b1aee /util | |
parent | bc7277bd012a28750ddeac83624567f23743d05d (diff) | |
download | prosody-7e50781f519fcad5c33b570e1996a8026841adc3.tar.gz prosody-7e50781f519fcad5c33b570e1996a8026841adc3.zip |
util.human.io: Fix pattern to support fractional proportions
Diffstat (limited to 'util')
-rw-r--r-- | util/human/io.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/human/io.lua b/util/human/io.lua index e5b22d50..9ecbe854 100644 --- a/util/human/io.lua +++ b/util/human/io.lua @@ -139,14 +139,14 @@ local function new_table(col_specs, max_width) local total_proportional_width = 0; for i = 1, #col_specs do if not widths[i] then - local width_spec = col_specs[i].width:match("(%d+)[p%%]"); + local width_spec = col_specs[i].width:match("([%d%.]+)[p%%]"); total_proportional_width = total_proportional_width + tonumber(width_spec); end end for i = 1, #col_specs do if not widths[i] then - local width_spec = col_specs[i].width:match("(%d+)[p%%]"); + local width_spec = col_specs[i].width:match("([%d%.]+)[p%%]"); local rel_width = tonumber(width_spec); widths[i] = math.floor(free_width*(rel_width/total_proportional_width)); end |