diff options
author | Gal Horowitz <galush.horowitz@gmail.com> | 2020-12-29 17:35:02 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-30 02:12:04 +0100 |
commit | 35c433862551c8db156396332431a70a2b23f13a (patch) | |
tree | c7d053bd21a839c025ed2e7b0ec5eb9cb731e852 /Applications/HexEditor/HexEditor.cpp | |
parent | fea498e9ac051497ce3b184a6ce0b734c60a2801 (diff) | |
download | serenity-35c433862551c8db156396332431a70a2b23f13a.zip |
HexEditor: Ignore control keys in text mode
The HexEditor now ignores control key events in text mode.
Previously null bytes were written.
Diffstat (limited to 'Applications/HexEditor/HexEditor.cpp')
-rw-r--r-- | Applications/HexEditor/HexEditor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 2eef357b15..dd464d3861 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -447,8 +447,11 @@ void HexEditor::text_mode_keydown_event(GUI::KeyEvent& event) ASSERT(m_position >= 0); ASSERT(m_position < static_cast<int>(m_buffer.size())); + if (event.code_point() == 0) // This is a control key + return; + m_tracked_changes.set(m_position, m_buffer.data()[m_position]); - m_buffer.data()[m_position] = (u8)event.text().characters()[0]; // save the first 4 bits, OR the new value in the last 4 + m_buffer.data()[m_position] = event.code_point(); if (m_position + 1 < static_cast<int>(m_buffer.size())) m_position++; m_byte_position = 0; |