mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00: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
1 changed files with 2 additions and 2 deletions
|
@ -668,7 +668,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
|
||||||
|
|
||||||
void HexEditor::select_all()
|
void HexEditor::select_all()
|
||||||
{
|
{
|
||||||
highlight(0, m_document->size() - 1);
|
highlight(0, m_document->size());
|
||||||
set_position(0);
|
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);
|
auto end_of_match = find(needle, start);
|
||||||
if (end_of_match.has_value()) {
|
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;
|
return end_of_match;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue