summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-08-12 03:07:36 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-12 03:07:36 +0200
commit6d6f354b425def8b4ab269cdd22cfb2328ce8591 (patch)
treeb02e2f09733454b0c7917ae238824bb4b318a00e /examples
parent1c8850023f2bdeae02ec061a49aa76dbb91262ad (diff)
parent3e59d824f8be029720f4064b49099e6aabc11179 (diff)
downloadiced-6d6f354b425def8b4ab269cdd22cfb2328ce8591.tar.gz
iced-6d6f354b425def8b4ab269cdd22cfb2328ce8591.tar.bz2
iced-6d6f354b425def8b4ab269cdd22cfb2328ce8591.zip
Merge pull request #2536 from meithecatte/editor-clipping
text_editor: Avoid rendering text outside the border
Diffstat (limited to 'examples')
-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(),
+ ]),
)
}