HexEditor: Don't update selection numbers when clicking the last+1 char

Clicking at the cell after the last one, where there's no character,
used to update the selection from/to numbers. Since there's no character
there, that shouldn't happen.
This commit is contained in:
Rok Povsic 2020-12-27 09:47:00 +01:00 committed by Andreas Kling
parent 5e66eda688
commit b2a6d2cea4
Notes: sideshowbarker 2024-07-19 00:32:55 +09:00

View File

@ -217,7 +217,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
auto byte_y = (absolute_y - hex_start_y) / line_height();
auto offset = (byte_y * m_bytes_per_row) + byte_x;
if (offset < 0 || offset > static_cast<int>(m_buffer.size()))
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
return;
#ifdef HEX_DEBUG
@ -239,7 +239,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
auto byte_y = (absolute_y - text_start_y) / line_height();
auto offset = (byte_y * m_bytes_per_row) + byte_x;
if (offset < 0 || offset > static_cast<int>(m_buffer.size()))
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
return;
#ifdef HEX_DEBUG