aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-04-06 15:03:45 +0100
committerMatthew Wild <mwild1@gmail.com>2023-04-06 15:03:45 +0100
commit7e50781f519fcad5c33b570e1996a8026841adc3 (patch)
tree98667f58a54324cc65365bef580dd60f989b1aee
parentbc7277bd012a28750ddeac83624567f23743d05d (diff)
downloadprosody-7e50781f519fcad5c33b570e1996a8026841adc3.tar.gz
prosody-7e50781f519fcad5c33b570e1996a8026841adc3.zip
util.human.io: Fix pattern to support fractional proportions
-rw-r--r--util/human/io.lua4
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