1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

HexEditor: Fixed off-by-one copying bug

When copying as hex or text we missed the last byte.
This commit is contained in:
Brandon Scott 2019-10-20 23:55:42 -05:00 committed by Andreas Kling
parent 5cc722cec4
commit 443eda986a

View file

@ -93,7 +93,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
return false;
StringBuilder output_string_builder;
for (int i = m_selection_start; i < m_selection_end; i++) {
for (int i = m_selection_start; i <= m_selection_end; i++) {
output_string_builder.appendf("%02X ", m_buffer.data()[i]);
}
@ -107,7 +107,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
return false;
StringBuilder output_string_builder;
for (int i = m_selection_start; i < m_selection_end; i++) {
for (int i = m_selection_start; i <= m_selection_end; i++) {
output_string_builder.appendf("%c", isprint(m_buffer.data()[i]) ? m_buffer[i] : '.');
}