diff options
author | Brandon Scott <xeons@users.noreply.github.com> | 2019-10-20 23:55:42 -0500 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-21 09:45:21 +0200 |
commit | 443eda986afd264a916b3904edbe780dc77b2a61 (patch) | |
tree | ba79c58398c52876ff379182c774c57abed5af65 | |
parent | 5cc722cec473b985d8e6d7b24adfa6121573b93b (diff) | |
download | serenity-443eda986afd264a916b3904edbe780dc77b2a61.zip |
HexEditor: Fixed off-by-one copying bug
When copying as hex or text we missed the last byte.
-rw-r--r-- | Applications/HexEditor/HexEditor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 4da3a9216b..a62b327069 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -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] : '.'); } |