mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
HexEditor: Remove moving cursor outside bounds if selecting with mouse
Currently if users select last bytes in HexEditor with mouse in either Hex or Text mode, they will be able to move cursor on the byte outside bounds. If then they try to write something in either of those modes, app will crash. This patch moves the recently added "replace" cursor to always be on the last byte of the selection instead of being on the byte after the last selected byte.
This commit is contained in:
parent
c4c9971ed0
commit
bd1d384cf6
Notes:
sideshowbarker
2024-07-17 20:19:08 +09:00
Author: https://github.com/tetektoza Commit: https://github.com/SerenityOS/serenity/commit/bd1d384cf6 Pull-request: https://github.com/SerenityOS/serenity/pull/22309 Reviewed-by: https://github.com/LucasChollet
@ -354,7 +354,7 @@ void HexEditor::mousemove_event(GUI::MouseEvent& event)
|
||||
return;
|
||||
|
||||
m_selection_end = offset;
|
||||
m_position = offset;
|
||||
m_position = (m_selection_end <= m_selection_start) ? offset : offset - 1;
|
||||
scroll_position_into_view(offset);
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ void HexEditor::mousemove_event(GUI::MouseEvent& event)
|
||||
return;
|
||||
|
||||
m_selection_end = offset;
|
||||
m_position = offset;
|
||||
m_position = (m_selection_end <= m_selection_start) ? offset : offset - 1;
|
||||
scroll_position_into_view(offset);
|
||||
}
|
||||
update_status();
|
||||
|
Loading…
Reference in New Issue
Block a user