config: Fix border rule on -> off merging
Browse files at this commit4e357e9659e5aafeec3cdeb18581698716d97a78Parent: 1f8aed61 changed file +11 -4
- niri-config/src/lib.rs +11 -4
niri-config/src/lib.rsmodified+11 -4
| @@ -1589,8 +1589,15 @@ impl Default for Config { | |||
| 1589 | 1589 | ||
| 1590 | impl BorderRule { | 1590 | impl BorderRule { |
| 1591 | pub fn merge_with(&mut self, other: &Self) { | 1591 | pub fn merge_with(&mut self, other: &Self) { |
| 1592 | - self.off |= other.off; | 1592 | + if other.off { |
| 1593 | - self.on |= other.on; | 1593 | + self.off = true; |
| 1594 | + self.on = false; | ||
| 1595 | + } | ||
| 1596 | + | ||
| 1597 | + if other.on { | ||
| 1598 | + self.off = false; | ||
| 1599 | + self.on = true; | ||
| 1600 | + } | ||
| 1594 | 1601 | ||
| 1595 | if let Some(x) = other.width { | 1602 | if let Some(x) = other.width { |
| 1596 | self.width = Some(x); | 1603 | self.width = Some(x); |
| @@ -3900,12 +3907,12 @@ mod tests { | |||
| 3900 | 3907 | ||
| 3901 | assert_snapshot!(is_on("off", &["off", "off"]), @"off"); | 3908 | assert_snapshot!(is_on("off", &["off", "off"]), @"off"); |
| 3902 | assert_snapshot!(is_on("off", &["off", "on"]), @"on"); | 3909 | assert_snapshot!(is_on("off", &["off", "on"]), @"on"); |
| 3903 | - assert_snapshot!(is_on("off", &["on", "off"]), @"on"); | 3910 | + assert_snapshot!(is_on("off", &["on", "off"]), @"off"); |
| 3904 | assert_snapshot!(is_on("off", &["on", "on"]), @"on"); | 3911 | assert_snapshot!(is_on("off", &["on", "on"]), @"on"); |
| 3905 | 3912 | ||
| 3906 | assert_snapshot!(is_on("on", &["off", "off"]), @"off"); | 3913 | assert_snapshot!(is_on("on", &["off", "off"]), @"off"); |
| 3907 | assert_snapshot!(is_on("on", &["off", "on"]), @"on"); | 3914 | assert_snapshot!(is_on("on", &["off", "on"]), @"on"); |
| 3908 | - assert_snapshot!(is_on("on", &["on", "off"]), @"on"); | 3915 | + assert_snapshot!(is_on("on", &["on", "off"]), @"off"); |
| 3909 | assert_snapshot!(is_on("on", &["on", "on"]), @"on"); | 3916 | assert_snapshot!(is_on("on", &["on", "on"]), @"on"); |
| 3910 | } | 3917 | } |
| 3911 | } | 3918 | } |