summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-16 00:15:58 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-16 01:24:34 +0200
commit966c5d10b149e8af70caa642b7f45ba2181fdd1d (patch)
tree4a9fe1a7242b77f2b54e531a274aff951d4f460b /LibGUI
parentf55965b5e84ac61a58aaed6e055680ca317a8540 (diff)
downloadserenity-966c5d10b149e8af70caa642b7f45ba2181fdd1d.zip
GTextEditor: Minor cleanup
Remove an unnecessary layer of nesting
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GTextEditor.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp
index 0b11e1ded0..7154ee032f 100644
--- a/LibGUI/GTextEditor.cpp
+++ b/LibGUI/GTextEditor.cpp
@@ -159,31 +159,32 @@ void GTextEditor::doubleclick_event(GMouseEvent& event)
void GTextEditor::mousedown_event(GMouseEvent& event)
{
- if (event.button() == GMouseButton::Left) {
- if (event.modifiers() & Mod_Shift) {
- if (!has_selection())
- m_selection.set(m_cursor, { });
- } else {
- m_selection.clear();
- }
-
- m_in_drag_select = true;
+ if (event.button() != GMouseButton::Left) {
+ return;
+ }
- set_cursor(text_position_at(event.position()));
+ if (event.modifiers() & Mod_Shift) {
+ if (!has_selection())
+ m_selection.set(m_cursor, { });
+ } else {
+ m_selection.clear();
+ }
- if (!(event.modifiers() & Mod_Shift)) {
- if (!has_selection())
- m_selection.set(m_cursor, { });
- }
+ m_in_drag_select = true;
- if (m_selection.start().is_valid() && m_selection.start() != m_cursor)
- m_selection.set_end(m_cursor);
+ set_cursor(text_position_at(event.position()));
- // FIXME: Only update the relevant rects.
- update();
- did_update_selection();
- return;
+ if (!(event.modifiers() & Mod_Shift)) {
+ if (!has_selection())
+ m_selection.set(m_cursor, { });
}
+
+ if (m_selection.start().is_valid() && m_selection.start() != m_cursor)
+ m_selection.set_end(m_cursor);
+
+ // FIXME: Only update the relevant rects.
+ update();
+ did_update_selection();
}
void GTextEditor::mouseup_event(GMouseEvent& event)