fix
This commit is contained in:
@@ -52,6 +52,7 @@ global FArena tape_arena;
|
||||
global FArena anno_arena;
|
||||
global U8 cursor_idx = 0;
|
||||
global U4 editor_mode = MODE_NAV;
|
||||
global U4 mode_switch_now = false;
|
||||
|
||||
// Executable Code Arena (The JIT)
|
||||
global FArena code_arena;
|
||||
@@ -278,7 +279,8 @@ S8 win_proc(void* hwnd, U4 msg, U8 wparam, S8 lparam)
|
||||
U1 c = u1_(wparam);
|
||||
|
||||
// Skip control characters and the 'E' that triggered the mode
|
||||
if (c < 32) break;
|
||||
bool should_skip = c < 32 || (c == 'e' && mode_switch_now);
|
||||
if (should_skip) { mode_switch_now = false; return 0; }
|
||||
|
||||
if (tag == STag_Data) {
|
||||
// Hex input
|
||||
@@ -314,8 +316,11 @@ S8 win_proc(void* hwnd, U4 msg, U8 wparam, S8 lparam)
|
||||
case MS_WM_KEYDOWN: {
|
||||
if (wparam == 0x45 && editor_mode == MODE_NAV) { // 'E'
|
||||
editor_mode = MODE_EDIT;
|
||||
mode_switch_now = true;
|
||||
ms_invalidate_rect(hwnd, nullptr, true);
|
||||
return 0; // Consume the keypress so it doesn't trigger WM_CHAR
|
||||
return 0;
|
||||
// ~~Consume the keypress so it doesn't trigger WM_CHAR~~
|
||||
// NOTE(Ed): Still triggers WM_CHAR we need to track when we just entered edit mode and that must be consumed.
|
||||
}
|
||||
if (wparam == 0x1B && editor_mode == MODE_EDIT) { // ESC
|
||||
editor_mode = MODE_NAV;
|
||||
|
||||
Reference in New Issue
Block a user