mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +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
Notes:
sideshowbarker
2024-07-19 00:25:12 +09:00
Author: https://github.com/GalHorowitz
Commit: 35c4338625
Pull-request: https://github.com/SerenityOS/serenity/pull/4632
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