Changeset

13031:1023c3faffac

util.human.io: Fix pattern to support fractional proportions
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Apr 2023 15:03:45 +0100
parents 13030:1f89a2a9f532
children 13032:ea4923bebca9
files util/human/io.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/human/io.lua	Thu Apr 06 14:51:52 2023 +0100
+++ b/util/human/io.lua	Thu Apr 06 15:03:45 2023 +0100
@@ -139,14 +139,14 @@
 	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