diff options
| author | pml68 <contact@pml68.me> | 2024-09-23 23:57:45 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.me> | 2024-09-23 23:57:45 +0200 |
| commit | bc2066220f656765cc820baeb687d8594fbc8826 (patch) | |
| tree | f4b9f25d3e3fbd96c2ddfaf70508b011b0ebaaaf /iced_builder/src/main.rs | |
| parent | feat: restructure project, start drag and drop (diff) | |
| download | iced-builder-bc2066220f656765cc820baeb687d8594fbc8826.tar.gz | |
feat: make code view scrollable, add autogen comment to code
Diffstat (limited to '')
| -rw-r--r-- | iced_builder/src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/iced_builder/src/main.rs b/iced_builder/src/main.rs index e966614..2633e6c 100644 --- a/iced_builder/src/main.rs +++ b/iced_builder/src/main.rs @@ -37,6 +37,7 @@ struct App { enum Message { ToggleTheme, CopyCode, + EditorAction(text_editor::Action), Drop(types::ElementName, iced::Point, iced::Rectangle), HandleZones( types::ElementName, @@ -107,6 +108,11 @@ impl Application for App { match message { Message::ToggleTheme => self.dark_theme = !self.dark_theme, Message::CopyCode => return clipboard::write(self.editor_content.text()), + Message::EditorAction(action) => { + if let text_editor::Action::Scroll { lines: _ } = action { + self.editor_content.perform(action); + } + } Message::Resized(pane_grid::ResizeEvent { split, ratio }) => { self.pane_state.resize(split, ratio); } @@ -190,6 +196,7 @@ impl Application for App { .style(style::title_bar); pane_grid::Content::new( text_editor(&self.editor_content) + .on_action(Message::EditorAction) .highlight::<Highlighter>( highlighter::Settings { theme: highlighter::Theme::Base16Mocha, |
