diff options
-rw-r--r-- | graphics/src/text/editor.rs | 12 | ||||
-rw-r--r-- | widget/src/text_editor.rs | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs index 4b8f0f2a..c488a51c 100644 --- a/graphics/src/text/editor.rs +++ b/graphics/src/text/editor.rs @@ -456,14 +456,10 @@ impl editor::Editor for Editor { } } Action::Scroll { lines } => { - let (_, height) = editor.buffer().size(); - - if height < i32::MAX as f32 { - editor.action( - font_system.raw(), - cosmic_text::Action::Scroll { lines }, - ); - } + editor.action( + font_system.raw(), + cosmic_text::Action::Scroll { lines }, + ); } } diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index 41b058af..fc2ade43 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -466,6 +466,12 @@ where shell.publish(on_edit(action)); } Update::Scroll(lines) => { + let bounds = self.content.0.borrow().editor.bounds(); + + if bounds.height >= i32::MAX as f32 { + return event::Status::Ignored; + } + let lines = lines + state.partial_scroll; state.partial_scroll = lines.fract(); |