First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -456,12 +456,11 @@ impl RulesLibrary {
pub fn new_rule(&mut self, window: &mut Window, cx: &mut Context<Self>) {
// If we already have an untitled rule, use that instead
// of creating a new one.
if let Some(metadata) = self.store.read(cx).first() {
if metadata.title.is_none() {
if let Some(metadata) = self.store.read(cx).first()
&& metadata.title.is_none() {
self.load_rule(metadata.id, true, window, cx);
return;
}
}
let prompt_id = PromptId::new();
let save = self.store.update(cx, |store, cx| {
@ -706,8 +705,7 @@ impl RulesLibrary {
.map_or(true, |old_selected_prompt| {
old_selected_prompt.id != prompt_id
})
{
if let Some(ix) = picker
&& let Some(ix) = picker
.delegate
.matches
.iter()
@ -715,7 +713,6 @@ impl RulesLibrary {
{
picker.set_selected_index(ix, None, true, window, cx);
}
}
} else {
picker.focus(window, cx);
}
@ -869,11 +866,10 @@ impl RulesLibrary {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(rule_id) = self.active_rule_id {
if let Some(rule_editor) = self.rule_editors.get(&rule_id) {
if let Some(rule_id) = self.active_rule_id
&& let Some(rule_editor) = self.rule_editors.get(&rule_id) {
window.focus(&rule_editor.body_editor.focus_handle(cx));
}
}
}
fn move_up_from_body(
@ -882,11 +878,10 @@ impl RulesLibrary {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(rule_id) = self.active_rule_id {
if let Some(rule_editor) = self.rule_editors.get(&rule_id) {
if let Some(rule_id) = self.active_rule_id
&& let Some(rule_editor) = self.rule_editors.get(&rule_id) {
window.focus(&rule_editor.title_editor.focus_handle(cx));
}
}
}
fn handle_rule_title_editor_event(