Repository: osa1/tiny (language: rust)

Issue:
Tabs still change color for join/part even if /ignore is enabled
Problem: when /ignore is enabled, tabs should not change color on the joining or parting of a user

This is my fault, I think. When I added the `JoinOrPart` tab style I didn't check this scenario.

It comes from these two identical lines in `conn.rs` :
```
ui.set_tab_style(TabStyle::JoinOrPart, &MsgTarget::Chan { serv, chan: &chan })
```
Doesn't look like there's a way to get the ignore from there without adding another function on `ui`, so you could probably change it here in `tui.rs`:
```
    pub(crate) fn set_tab_style(&mut self, style: TabStyle, target: &MsgTarget) {
        self.apply_to_target(target, &|tab: &mut Tab, is_active: bool| {
            if !is_active && tab.style < style {
                tab.set_style(style);
            }
        });
    }
```


Discussion / hints:
Good catch @trevarj . I think you're right that `set_tab_style` is where we fix this.

Fix patch:
diff --git a/libtiny_tui/src/messaging.rs b/libtiny_tui/src/messaging.rs
index a05ddfd3..4729d838 100644
--- a/libtiny_tui/src/messaging.rs
+++ b/libtiny_tui/src/messaging.rs
@@ -410,7 +410,7 @@ impl MessagingUI {
         }
     }
 
-    pub(crate) fn get_ignore_state(&self) -> bool {
+    pub(crate) fn is_showing_status(&self) -> bool {
         self.show_status
     }
 
diff --git a/libtiny_tui/src/tui.rs b/libtiny_tui/src/tui.rs
index b1344ba4..52f4c14d 100644
--- a/libtiny_tui/src/tui.rs
+++ b/libtiny_tui/src/tui.rs
@@ -418,7 +418,7 @@ impl TUI {
                     for tab in &self.tabs {
                         if let MsgSource::Serv { serv: ref serv_ } = tab.src {
                             if serv == serv_ {
-                                status_val = tab.widget.get_ignore_state();
+                                status_val = tab.widget.is_showing_status();
                                 notifier = Some(tab.notifier);
                                 break;
                             }
@@ -879,7 +879,7 @@ impl TUI {
                 &self.colors,
                 &self.tabs[self.active_idx].visible_name(),
                 self.tabs[self.active_idx].notifier,
-                self.tabs[self.active_idx].widget.get_ignore_state(),
+                self.tabs[self.active_idx].widget.is_showing_status(),
             );
         }
 
@@ -1213,7 +1213,10 @@ impl TUI {
 
     pub(crate) fn set_tab_style(&mut self, style: TabStyle, target: &MsgTarget) {
         self.apply_to_target(target, &|tab: &mut Tab, is_active: bool| {
-            if !is_active && tab.style < style {
+            if !is_active
+                && tab.style < style
+                && !(style == TabStyle::JoinOrPart && !tab.widget.is_showing_status())
+            {
                 tab.set_style(style);
             }
         });
@@ -1348,7 +1351,7 @@ impl TUI {
             for tab in &self.tabs {
                 if let MsgSource::Serv { serv: ref serv_ } = tab.src {
                     if serv == serv_ {
-                        status_val = tab.widget.get_ignore_state();
+                        status_val = tab.widget.is_showing_status();
                         break;
                     }
                 }


Test patch: