label: Fix Label highlight may crash of not a char boundary. (#1574)
This commit is contained in:
parent
cbd4346b87
commit
3500e5d5bc
2 changed files with 4 additions and 2 deletions
|
|
@ -113,7 +113,9 @@ impl Render for LabelStory {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_y_4()
|
.gap_y_4()
|
||||||
.child(Label::new("This is a label").highlights(ht.clone()))
|
.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(
|
.child(
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ impl Label {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(highlights)
|
Some(gpui::combine_highlights(vec![], highlights).collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue