Merge pull request #2536 from meithecatte/editor-clipping

text_editor: Avoid rendering text outside the border
This commit is contained in:
Héctor Ramón 2024-08-12 03:07:36 +02:00 committed by GitHub
commit 6d6f354b42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 34 deletions

View file

@ -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(),
]),
)
}