input: Fix the panic issue in end_of_line (#922)

This commit is contained in:
Floyd Wang 2025-06-06 10:07:11 +08:00 committed by GitHub
parent 74de042b60
commit 936ee27a2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1057,7 +1057,7 @@ impl InputState {
// ignore if offset is "\n"
if self
.text_for_range(
self.range_to_utf16(&(offset - 1..offset)),
self.range_to_utf16(&(offset.saturating_sub(1)..offset)),
&mut None,
window,
cx,