summaryrefslogtreecommitdiff
path: root/Applications/HexEditor/HexEditor.cpp
diff options
context:
space:
mode:
authorGal Horowitz <galush.horowitz@gmail.com>2020-12-29 17:35:02 +0200
committerAndreas Kling <kling@serenityos.org>2020-12-30 02:12:04 +0100
commit35c433862551c8db156396332431a70a2b23f13a (patch)
treec7d053bd21a839c025ed2e7b0ec5eb9cb731e852 /Applications/HexEditor/HexEditor.cpp
parentfea498e9ac051497ce3b184a6ce0b734c60a2801 (diff)
downloadserenity-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.cpp5
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;