terminal: Update search match highlights on resize (#43507)

Anthony Eid created

The fix for this is emitting a wake-up event to tell the terminal to
recalculate its search highlights on resize.

Release Notes:

- terminal: Fix bug where search match highlights wouldn't update their
position when resizing the terminal.

Change summary

crates/terminal/src/terminal.rs | 6 ++++++
1 file changed, 6 insertions(+)

Detailed changes

crates/terminal/src/terminal.rs 🔗

@@ -992,6 +992,12 @@ impl Terminal {
                 }
 
                 term.resize(new_bounds);
+                // If there are matches we need to emit a wake up event to
+                // invalidate the matches and recalculate their locations
+                // in the new terminal layout
+                if !self.matches.is_empty() {
+                    cx.emit(Event::Wakeup);
+                }
             }
             InternalEvent::Clear => {
                 trace!("Clearing");