about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-11-03 21:34:23 +0530
committerAndinus <andinus@nand.sh>2021-11-03 21:34:23 +0530
commitbffe38efe8180fc2d16947e9cb4afd85fdb76cd1 (patch)
tree0625a20f1f87d1907fe399600c544b1be8d3db89
parente1e90993013b15b63409859fba8476de4da6924d (diff)
downloadfornax-bffe38efe8180fc2d16947e9cb4afd85fdb76cd1.tar.gz
Fix excess space calculation
Earlier we assumed that rows == columns.
-rw-r--r--lib/Fornax/CLI.rakumod4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Fornax/CLI.rakumod b/lib/Fornax/CLI.rakumod
index 3918fc1..cdc910d 100644
--- a/lib/Fornax/CLI.rakumod
+++ b/lib/Fornax/CLI.rakumod
@@ -54,10 +54,10 @@ multi sub MAIN(
     # Consider width if cells with dimension (width * width) fit
     # within the canvas, otherwise consider the height.
     if (%cell<width> * %meta<rows>) < %CANVAS<height> {
-        %excess<height> = abs %CANVAS<width> - %CANVAS<height>;
+        %excess<height> = %CANVAS<height> - (%cell<width> * %meta<rows>);
         $side = %cell<width>;
     } else {
-        %excess<width> = abs %CANVAS<width> - %CANVAS<height>;
+        %excess<width> = %CANVAS<width> - (%cell<height> * %meta<cols>);
         $side = %cell<height>;
     }