From: Olaf Wintermann Date: Sun, 2 Aug 2026 15:03:05 +0000 (+0200) Subject: improve custom title editing behavior X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=HEAD;p=note.git improve custom title editing behavior --- diff --git a/application/note/src/note.rs b/application/note/src/note.rs index 54b2176..a97cc0d 100644 --- a/application/note/src/note.rs +++ b/application/note/src/note.rs @@ -163,6 +163,7 @@ impl Note { } else { self.lock = None; self.text.set_readonly(false); + doc.ctx.unset_state(AppStates::NoteTitleInput as i32); } Some(()) @@ -406,9 +407,23 @@ impl Note { } let title = self.title.get(); - self.notify_title_change(title.as_str()); + if title.is_empty() { + let text = self.text.get(); + let title = match generate_title(text.as_str()) { + Some(result) => { + result.0 + }, + None => { + "New Note" // TODO: see NoteItem::new() + } + }; + self.notify_title_change(title); + self.fixed_title = false; + } else { + self.notify_title_change(title.as_str()); + self.fixed_title = true; + } self.modified = true; - self.fixed_title = true; } #[action]