From 4e357e9659e5aafeec3cdeb18581698716d97a78 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 27 Dec 2024 15:40:48 +0300 Subject: config: Fix border rule on -> off merging --- niri-config/src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index d5d45650..fc1fdfd4 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -1589,8 +1589,15 @@ impl Default for Config { impl BorderRule { pub fn merge_with(&mut self, other: &Self) { - self.off |= other.off; - self.on |= other.on; + if other.off { + self.off = true; + self.on = false; + } + + if other.on { + self.off = false; + self.on = true; + } if let Some(x) = other.width { self.width = Some(x); @@ -3900,12 +3907,12 @@ mod tests { assert_snapshot!(is_on("off", &["off", "off"]), @"off"); assert_snapshot!(is_on("off", &["off", "on"]), @"on"); - assert_snapshot!(is_on("off", &["on", "off"]), @"on"); + assert_snapshot!(is_on("off", &["on", "off"]), @"off"); assert_snapshot!(is_on("off", &["on", "on"]), @"on"); assert_snapshot!(is_on("on", &["off", "off"]), @"off"); assert_snapshot!(is_on("on", &["off", "on"]), @"on"); - assert_snapshot!(is_on("on", &["on", "off"]), @"on"); + assert_snapshot!(is_on("on", &["on", "off"]), @"off"); assert_snapshot!(is_on("on", &["on", "on"]), @"on"); } } -- cgit