diff options
author | 2024-04-26 15:17:10 +0200 | |
---|---|---|
committer | 2024-04-26 15:17:10 +0200 | |
commit | 3762c0590ceb0fc579a1e699702d7d5c2b204348 (patch) | |
tree | 455fb7b6b2fa6173a4c88941583524012154ec2c /graphics | |
parent | 40c4aa8ff25f27e9bbc43f8fc2aa161e63396172 (diff) | |
download | iced-3762c0590ceb0fc579a1e699702d7d5c2b204348.tar.gz iced-3762c0590ceb0fc579a1e699702d7d5c2b204348.tar.bz2 iced-3762c0590ceb0fc579a1e699702d7d5c2b204348.zip |
Fix panic when scrolling a `TextEditor` inside a `scrollable`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/text/editor.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs index c488a51c..4b8f0f2a 100644 --- a/graphics/src/text/editor.rs +++ b/graphics/src/text/editor.rs @@ -456,10 +456,14 @@ impl editor::Editor for Editor { } } Action::Scroll { lines } => { - editor.action( - font_system.raw(), - cosmic_text::Action::Scroll { lines }, - ); + let (_, height) = editor.buffer().size(); + + if height < i32::MAX as f32 { + editor.action( + font_system.raw(), + cosmic_text::Action::Scroll { lines }, + ); + } } } |