mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-05 15:16:23 +01:00
fix weird bug with some flags sometimes crashing (on even numbers)
This commit is contained in:
parent
6f5884a8a3
commit
b23856722c
|
@ -17,14 +17,14 @@ def flag [
|
||||||
mut cols = $colors | wrap color | insert width $col_size | flatten;
|
mut cols = $colors | wrap color | insert width $col_size | flatten;
|
||||||
let last = ($colors | length) - 1;
|
let last = ($colors | length) - 1;
|
||||||
|
|
||||||
$cols = if not ($rest | is even) {
|
if not ($rest | is even) {
|
||||||
$rest = $rest - 1;
|
$rest = $rest - 1;
|
||||||
|
|
||||||
(if not ($colors | length | is even) {
|
$cols = (if not ($colors | length | is even) {
|
||||||
$cols | update (($colors | length) / 2 | math floor) { $in | update width {|w| ($w.width + 1)}}
|
$cols | update (($colors | length) / 2 | math floor) { $in | update width {|w| ($w.width + 1)}}
|
||||||
} else {
|
} else {
|
||||||
$cols | update $last { $in | update width {|w| ($w.width + 1)}}
|
$cols | update $last { $in | update width {|w| ($w.width + 1)}}
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
std assert ($rest | is even);
|
std assert ($rest | is even);
|
||||||
|
|
Loading…
Reference in a new issue