label: Fix Label highlight may crash of not a char boundary. (#1574)

This commit is contained in:
Jason Lee 2025-11-12 18:19:43 +08:00 committed by GitHub
parent cbd4346b87
commit 3500e5d5bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -113,7 +113,9 @@ impl Render for LabelStory {
v_flex()
.gap_y_4()
.child(Label::new("This is a label").highlights(ht.clone()))
.child(Label::new("这是一个标签").highlights(ht.clone())),
// This case for test match CJK with ASCII, it was has a crash bug before.
// Try to input "AA" to see the highlights effect.
.child(Label::new("AAA中文BB").highlights(ht.clone())),
),
)
.child(

View file

@ -181,7 +181,7 @@ impl Label {
));
}
Some(highlights)
Some(gpui::combine_highlights(vec![], highlights).collect())
}
}