aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-27 15:40:48 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-27 15:42:56 +0300
commit4e357e9659e5aafeec3cdeb18581698716d97a78 (patch)
tree55bca6b7993d718cf19076021b6d17480d3e15af
parent1f8aed673263748d9fbf61ca50d763abd221b257 (diff)
downloadniri-4e357e9659e5aafeec3cdeb18581698716d97a78.tar.gz
niri-4e357e9659e5aafeec3cdeb18581698716d97a78.tar.bz2
niri-4e357e9659e5aafeec3cdeb18581698716d97a78.zip
config: Fix border rule on -> off merging
-rw-r--r--niri-config/src/lib.rs15
1 files 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");
}
}