gpui: Fix division by zero when chars/sec = 0 on Wayland (#44151) (cherry-pick to preview) (#44154)

zed-zippy[bot] and Rawand Ahmed Shaswar created

Cherry-pick of #44151 to preview

----
Closes #44148

the existing rate == 0 check inside the timer callback already handles
disabling repeat - it just drops the timer immediately. So the fix
prevents the crash while preserving correct behavior. 

Release Notes:

- Linux (Wayland): Fixed a crash that could occur when
`characters_per_second` was zero

Co-authored-by: Rawand Ahmed Shaswar <rawandahmad698@gmail.com>

Change summary

crates/gpui/src/platform/linux/wayland/client.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/gpui/src/platform/linux/wayland/client.rs 🔗

@@ -1419,7 +1419,7 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
                         state.repeat.current_keycode = Some(keycode);
 
                         let rate = state.repeat.characters_per_second;
-                        let repeat_interval = Duration::from_secs(1) / rate;
+                        let repeat_interval = Duration::from_secs(1) / rate.max(1);
                         let id = state.repeat.current_id;
                         state
                             .loop_handle