summaryrefslogtreecommitdiff
path: root/Applications/HexEditor
diff options
context:
space:
mode:
authorRok Povsic <rok.povsic@gmail.com>2020-12-27 09:46:08 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-27 21:25:54 +0100
commit5e66eda6884cf4bd796d97beb7b606b70a3c91de (patch)
tree52731737686757d9f94ab12e0415f7eba0a0b929 /Applications/HexEditor
parentfec7501d1ab7ee3628d09e6ac8b5a8e72bec821c (diff)
downloadserenity-5e66eda6884cf4bd796d97beb7b606b70a3c91de.zip
HexEditor: Make single-character selection display proper start/end
Previously, -1 / -1 was displayed. Fixes #3555
Diffstat (limited to 'Applications/HexEditor')
-rw-r--r--Applications/HexEditor/HexEditor.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp
index 0cb11aea6e..693f3b708b 100644
--- a/Applications/HexEditor/HexEditor.cpp
+++ b/Applications/HexEditor/HexEditor.cpp
@@ -229,7 +229,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
m_position = offset;
m_in_drag_select = true;
m_selection_start = offset;
- m_selection_end = -1;
+ m_selection_end = offset;
update();
update_status();
}
@@ -250,7 +250,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
m_byte_position = 0;
m_in_drag_select = true;
m_selection_start = offset;
- m_selection_end = -1;
+ m_selection_end = offset;
m_edit_mode = EditMode::Text;
update();
update_status();
@@ -314,10 +314,7 @@ void HexEditor::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() == GUI::MouseButton::Left) {
if (m_in_drag_select) {
- if (m_selection_end == -1 || m_selection_start == -1) {
- m_selection_start = -1;
- m_selection_end = -1;
- } else if (m_selection_end < m_selection_start) {
+ if (m_selection_end < m_selection_start) {
// lets flip these around
auto start = m_selection_end;
m_selection_end = m_selection_start;