helix-term:fix crash on unwrap graphemes

This change replaces a direct unwrap with a map. If the optional value
is missing, a default is used.

The issue was discovered accidentally while porting the Helix editor to
an ARM-based platform and running it in QEMU.
pull/14050/head
Alexander Shirokov 2025-07-23 14:33:50 +02:00
parent b01fbb4a22
commit 1007e0c3df
No known key found for this signature in database
GPG Key ID: 6020E4D7AFA8ECE7
1 changed files with 2 additions and 2 deletions

View File

@ -779,8 +779,8 @@ impl Component for Prompt {
col += self.line[self.cursor..] col += self.line[self.cursor..]
.graphemes(true) .graphemes(true)
.next() .next()
.unwrap() .map(|g| g.width())
.width(); .unwrap_or(0);
} }
let line = area.height as usize - 1; let line = area.height as usize - 1;