mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
HexEditor: Make single-character selection display proper start/end
Previously, -1 / -1 was displayed. Fixes #3555
This commit is contained in:
parent
fec7501d1a
commit
5e66eda688
Notes:
sideshowbarker
2024-07-19 00:32:59 +09:00
Author: https://github.com/rok-povsic Commit: https://github.com/SerenityOS/serenity/commit/5e66eda6884 Pull-request: https://github.com/SerenityOS/serenity/pull/4568 Issue: https://github.com/SerenityOS/serenity/issues/3555
1 changed files with 3 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue