1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:17:44 +00:00

LibWeb: Fix many bugs with the editing.

This commit is contained in:
asynts 2020-12-03 18:20:17 +01:00 committed by Andreas Kling
parent 78558c9f30
commit b3d7c5bfbc
2 changed files with 4 additions and 9 deletions

View file

@ -346,12 +346,14 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
}
if (layout_root()->selection().is_valid()) {
auto range = layout_root()->selection().to_dom_range();
auto range = layout_root()->selection().to_dom_range().normalized();
m_frame.document()->layout_node()->set_selection({});
// FIXME: This doesn't work for some reason?
m_frame.set_cursor_position(range.start());
if (key == KeyCode::Key_Backspace) {
if (key == KeyCode::Key_Backspace || key == KeyCode::Key_Delete) {
if (range.start().node()->is_editable()) {
m_edit_event_handler->handle_delete(range);
return true;