Fix text_editor always capturing scroll events

This commit is contained in:
Héctor Ramón Jiménez 2024-06-17 03:37:00 +02:00
parent e9141e7abf
commit 6c1027af8d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 10 additions and 8 deletions

View file

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

View file

@ -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();