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

HexEditor: Copy as C code doesn't add trailing spaces

This commit is contained in:
Samu698 2022-03-13 18:38:30 +01:00 committed by Andreas Kling
parent 79deb7d6c7
commit 7bf4ed98d7

View file

@ -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");