chore: fix some performance issues (#6)
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m14s

Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
2026-02-14 02:01:49 +00:00
parent ecd7f6aa9b
commit e327178161
11 changed files with 667 additions and 706 deletions

View File

@@ -1009,8 +1009,7 @@ impl InputState {
let left_part = self.text.slice(0..offset).to_string();
UnicodeSegmentation::split_word_bound_indices(left_part.as_str())
.filter(|(_, s)| !s.trim_start().is_empty())
.next_back()
.rfind(|(_, s)| !s.trim_start().is_empty())
.map(|(i, _)| i)
.unwrap_or(0)
}

View File

@@ -1094,13 +1094,10 @@ impl Render for PopupMenu {
self.update_submenu_menu_anchor(window);
let max_width = self.max_width();
let max_height = self.max_height.map_or_else(
|| {
let window_half_height = window.window_bounds().get_bounds().size.height * 0.5;
window_half_height.min(px(450.))
},
|height| height,
);
let max_height = self.max_height.unwrap_or_else(|| {
let window_half_height = window.window_bounds().get_bounds().size.height * 0.5;
window_half_height.min(px(450.))
});
let view = cx.entity().clone();
let items_count = self.menu_items.len();