From 1007e0c3df30ed7d213ca6ac888f461d30b9f5fe Mon Sep 17 00:00:00 2001 From: Alexander Shirokov Date: Wed, 23 Jul 2025 14:33:50 +0200 Subject: [PATCH] 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. --- helix-term/src/ui/prompt.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index ff4ca1fcc..57da74494 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -779,8 +779,8 @@ impl Component for Prompt { col += self.line[self.cursor..] .graphemes(true) .next() - .unwrap() - .width(); + .map(|g| g.width()) + .unwrap_or(0); } let line = area.height as usize - 1;