Avoid subtraction underflow when searching terminal

Max Brunsfeld and Keith Simmons created

Co-authored-by: Keith Simmons <keith@zed.dev>

Change summary

crates/terminal/src/terminal_container_view.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/terminal/src/terminal_container_view.rs 🔗

@@ -432,7 +432,7 @@ impl SearchableItem for TerminalContainer {
                 }
 
                 // If no selection after selection head, return the last match
-                return Some(matches.len() - 1);
+                return Some(matches.len().saturating_sub(1));
             } else {
                 Some(0)
             }