mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 23:56:06 +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:
parent
5cc722cec4
commit
443eda986a
Notes:
sideshowbarker
2024-07-19 11:36:21 +09:00
Author: https://github.com/xeons
Commit: 443eda986a
Pull-request: https://github.com/SerenityOS/serenity/pull/678
1 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StringBuilder output_string_builder;
|
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]);
|
output_string_builder.appendf("%02X ", m_buffer.data()[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StringBuilder output_string_builder;
|
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] : '.');
|
output_string_builder.appendf("%c", isprint(m_buffer.data()[i]) ? m_buffer[i] : '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue