mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-30 18:14:14 +01:00
Merge outside PR #259: Select the default symbol name when converting to symbol (M8)
This commit is contained in:
commit
18b8b998ce
1 file changed
+7
@@ -7,6 +7,7 @@ use crate::app::App;
|
||||
use crate::theme::{FORM_LABEL_DOCK, Type, form_row, text};
|
||||
use anicraft_engine::doc::{Document, FolderId, LibraryEntry, SymbolKind};
|
||||
use egui::Key;
|
||||
use egui::text::{CCursor, CCursorRange};
|
||||
use serde_json::json;
|
||||
|
||||
/// The dialog while it is open.
|
||||
@@ -75,6 +76,12 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
let r = ui.add(egui::TextEdit::singleline(&mut d.name).desired_width(f32::INFINITY)).named(tr!("Symbol name"));
|
||||
if d.focus {
|
||||
r.request_focus();
|
||||
if let Some(mut state) = egui::TextEdit::load_state(ui.ctx(), r.id) {
|
||||
let start = CCursor::new(0);
|
||||
let end = CCursor::new(d.name.chars().count());
|
||||
state.cursor.set_char_range(Some(CCursorRange::two(start, end)));
|
||||
state.store(ui.ctx(), r.id);
|
||||
}
|
||||
d.focus = false;
|
||||
}
|
||||
if r.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter)) {
|
||||
|
||||
Reference in new issue
Block a user