1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

HexEditor: Add selection strings to the value inspector

Strings include ASCII, UTF-8, and UTF-16

Co-authored-by: Andreas Krohn <hamburger1984@gmail.com>
This commit is contained in:
MetallicSquid 2022-04-26 14:14:05 +01:00 committed by Sam Atkins
parent 815442b2b5
commit eb27b397b8
5 changed files with 40 additions and 1 deletions

View file

@ -245,6 +245,18 @@ Optional<u8> HexEditor::get_byte(size_t position)
return {};
}
ByteBuffer HexEditor::get_selected_bytes()
{
auto num_selected_bytes = m_selection_end - m_selection_start;
ByteBuffer data;
data.ensure_capacity(num_selected_bytes);
for (size_t i = m_selection_start; i < m_selection_end; i++)
data.append(m_document->get(i).value);
return data;
}
void HexEditor::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Primary) {