Skip to content

Commit

Permalink
LibWeb: Extend text selection when left clicking and holding shift
Browse files Browse the repository at this point in the history
  • Loading branch information
tcl3 committed Jun 5, 2024
1 parent c6e9f0e commit 4067a2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Userland/Libraries/LibWeb/Page/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,11 @@ bool EventHandler::handle_mousedown(CSSPixelPoint position, CSSPixelPoint screen
auto& realm = document->realm();
m_navigable->set_cursor_position(DOM::Position::create(realm, *paintable->dom_node(), result->index_in_node));
if (auto selection = document->get_selection()) {
(void)selection->set_base_and_extent(*paintable->dom_node(), result->index_in_node, *paintable->dom_node(), result->index_in_node);
if (modifiers & KeyModifier::Mod_Shift) {
(void)selection->set_base_and_extent(*selection->anchor_node(), selection->anchor_offset(), *paintable->dom_node(), result->index_in_node);
} else {
(void)selection->set_base_and_extent(*paintable->dom_node(), result->index_in_node, *paintable->dom_node(), result->index_in_node);
}
}
m_in_mouse_selection = true;
}
Expand Down

0 comments on commit 4067a2c

Please sign in to comment.