summaryrefslogtreecommitdiffstats
path: root/examples/editor
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-12 02:55:49 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-12 02:55:49 +0200
commit373e887a5834dbf2272aeaea8f1820ee90698400 (patch)
tree580c79c5a483b788f05713b8154c3c3483a55ca8 /examples/editor
parentbe7d175388076cf24ca902a2d4cd457ce2a8e9ab (diff)
downloadiced-373e887a5834dbf2272aeaea8f1820ee90698400.tar.gz
iced-373e887a5834dbf2272aeaea8f1820ee90698400.tar.bz2
iced-373e887a5834dbf2272aeaea8f1820ee90698400.zip
Focus `text_editor` at start-up in `editor` example
Diffstat (limited to 'examples/editor')
-rw-r--r--examples/editor/src/main.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/editor/src/main.rs b/examples/editor/src/main.rs
index 155e74a1..aa07b328 100644
--- a/examples/editor/src/main.rs
+++ b/examples/editor/src/main.rs
@@ -1,7 +1,7 @@
use iced::highlighter;
use iced::keyboard;
use iced::widget::{
- button, column, container, horizontal_space, pick_list, row, text,
+ self, button, column, container, horizontal_space, pick_list, row, text,
text_editor, tooltip,
};
use iced::{Center, Element, Fill, Font, Subscription, Task, Theme};
@@ -49,13 +49,16 @@ impl Editor {
is_loading: true,
is_dirty: false,
},
- Task::perform(
- load_file(format!(
- "{}/src/main.rs",
- env!("CARGO_MANIFEST_DIR")
- )),
- Message::FileOpened,
- ),
+ Task::batch([
+ Task::perform(
+ load_file(format!(
+ "{}/src/main.rs",
+ env!("CARGO_MANIFEST_DIR")
+ )),
+ Message::FileOpened,
+ ),
+ widget::focus_next(),
+ ]),
)
}