diff options
author | Samu698 <samu2altervista@gmail.com> | 2022-03-13 18:38:30 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-14 22:48:16 +0100 |
commit | 7bf4ed98d70f01207d56f167c6b6cfb16c615e18 (patch) | |
tree | 1ea04387203b9c65d9af4fad211dae4bdb421acb /Userland | |
parent | 79deb7d6c7db99a4c9bc30f971e20b005588b940 (diff) | |
download | serenity-7bf4ed98d70f01207d56f167c6b6cfb16c615e18.zip |
HexEditor: Copy as C code doesn't add trailing spaces
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/HexEditor/HexEditor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index 62d292c485..409535ab9b 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -185,12 +185,12 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code() output_string_builder.append(" "); for (size_t i = m_selection_start, j = 1; i < m_selection_end; i++, j++) { output_string_builder.appendff("{:#02X}", m_document->get(i).value); - if (i != m_selection_end) + if (i >= m_selection_end - 1) + continue; + if ((j % 12) == 0) + output_string_builder.append(",\n "); + else output_string_builder.append(", "); - if ((j % 12) == 0) { - output_string_builder.append("\n"); - output_string_builder.append(" "); - } } output_string_builder.append("\n};\n"); |