mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
HexEditor: Fix two off-by-one errors
The 'select all' feature now also selects the last byte of the document. The find function now also selects the last byte of a match.
This commit is contained in:
parent
6926991a56
commit
279121fa10
Notes:
sideshowbarker
2024-07-17 06:01:02 +09:00
Author: https://github.com/Maato Commit: https://github.com/SerenityOS/serenity/commit/279121fa10 Pull-request: https://github.com/SerenityOS/serenity/pull/15556
@ -668,7 +668,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
|
||||
|
||||
void HexEditor::select_all()
|
||||
{
|
||||
highlight(0, m_document->size() - 1);
|
||||
highlight(0, m_document->size());
|
||||
set_position(0);
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ Optional<size_t> HexEditor::find_and_highlight(ByteBuffer& needle, size_t start)
|
||||
{
|
||||
auto end_of_match = find(needle, start);
|
||||
if (end_of_match.has_value()) {
|
||||
highlight(end_of_match.value() - needle.size(), end_of_match.value() - 1);
|
||||
highlight(end_of_match.value() - needle.size(), end_of_match.value());
|
||||
}
|
||||
return end_of_match;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user