Focus text_editor at start-up in editor example
This commit is contained in:
parent
be7d175388
commit
373e887a58
1 changed files with 11 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
use iced::highlighter;
|
use iced::highlighter;
|
||||||
use iced::keyboard;
|
use iced::keyboard;
|
||||||
use iced::widget::{
|
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,
|
text_editor, tooltip,
|
||||||
};
|
};
|
||||||
use iced::{Center, Element, Fill, Font, Subscription, Task, Theme};
|
use iced::{Center, Element, Fill, Font, Subscription, Task, Theme};
|
||||||
|
|
@ -49,13 +49,16 @@ impl Editor {
|
||||||
is_loading: true,
|
is_loading: true,
|
||||||
is_dirty: false,
|
is_dirty: false,
|
||||||
},
|
},
|
||||||
Task::perform(
|
Task::batch([
|
||||||
load_file(format!(
|
Task::perform(
|
||||||
"{}/src/main.rs",
|
load_file(format!(
|
||||||
env!("CARGO_MANIFEST_DIR")
|
"{}/src/main.rs",
|
||||||
)),
|
env!("CARGO_MANIFEST_DIR")
|
||||||
Message::FileOpened,
|
)),
|
||||||
),
|
Message::FileOpened,
|
||||||
|
),
|
||||||
|
widget::focus_next(),
|
||||||
|
]),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue