Repository: Canop/bacon (language: rust)

Issue:
Trying to wrap or unwrap lines in raw mode does nothing
On macOS, when I use `toggle-raw-output` to go back to the original verbose test output, I can't wrap or unwrap lines.

Steps to reproduce:
1. Run a test with long lines and failures
2. Wait for it to finish, which goes to the fails summary screen
3. Do `toggle-raw-output` (I use my own key binding for this)
4. Try to wrap or unwrap lines

Expected outcome:
Line wrapping changes

Actual outcome:
Line wrapping does not change

If raw mode ignored wrapping entirely, that would be consistent but annoying. Instead, raw mode won't unwrap-to-wrap or wrap-to-unwrap lines.


Discussion / hints:
Confirmed. Thanks for the report.

Fix patch:
diff --git a/src/state.rs b/src/state.rs
index 9802a31..9b69820 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -165,6 +165,12 @@ impl<'s> AppState<'s> {
     }
     pub fn toggle_raw_output(&mut self) {
         self.raw_output ^= true;
+        if self.wrapped_output.is_some() {
+            self.wrapped_output = None;
+        }
+        if self.wrap {
+            self.update_wrap(self.width - 1);
+        }
     }
     pub fn set_result(
         &mut self,
@@ -341,6 +347,12 @@ impl<'s> AppState<'s> {
     }
     pub fn toggle_wrap_mode(&mut self) {
         self.wrap ^= true;
+        if self.wrapped_output.is_some() {
+            self.wrapped_output = None;
+        }
+        if self.wrap {
+            self.update_wrap(self.width - 1);
+        }
         if self.wrapped_report.is_some() {
             self.try_scroll_to_last_top_item();
         }


Test patch: