mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
HexEditor: Ignore control keys in text mode
The HexEditor now ignores control key events in text mode. Previously null bytes were written.
This commit is contained in:
parent
fea498e9ac
commit
35c4338625
1 changed files with 4 additions and 1 deletions
|
@ -447,8 +447,11 @@ void HexEditor::text_mode_keydown_event(GUI::KeyEvent& event)
|
||||||
ASSERT(m_position >= 0);
|
ASSERT(m_position >= 0);
|
||||||
ASSERT(m_position < static_cast<int>(m_buffer.size()));
|
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_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()))
|
if (m_position + 1 < static_cast<int>(m_buffer.size()))
|
||||||
m_position++;
|
m_position++;
|
||||||
m_byte_position = 0;
|
m_byte_position = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue