mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
top-level text editing mode state, so that textual keys can be used for hotkeys, but just become disabled when text editing is actually happening
This commit is contained in:
@@ -10708,6 +10708,8 @@ rd_frame(void)
|
|||||||
rd_state->frame_di_scope = di_scope_open();
|
rd_state->frame_di_scope = di_scope_open();
|
||||||
rd_state->frame_fzy_scope = fzy_scope_open();
|
rd_state->frame_fzy_scope = fzy_scope_open();
|
||||||
}
|
}
|
||||||
|
B32 allow_text_hotkeys = !rd_state->text_edit_mode;
|
||||||
|
rd_state->text_edit_mode = 0;
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: get events from the OS
|
//- rjf: get events from the OS
|
||||||
@@ -10806,7 +10808,7 @@ rd_frame(void)
|
|||||||
rd_unbind_name(rd_state->bind_change_cmd_name, rd_state->bind_change_binding);
|
rd_unbind_name(rd_state->bind_change_cmd_name, rd_state->bind_change_binding);
|
||||||
rd_bind_name(rd_state->bind_change_cmd_name, binding);
|
rd_bind_name(rd_state->bind_change_cmd_name, binding);
|
||||||
U32 codepoint = os_codepoint_from_modifiers_and_key(event->modifiers, event->key);
|
U32 codepoint = os_codepoint_from_modifiers_and_key(event->modifiers, event->key);
|
||||||
os_text(&events, os_handle_zero(), codepoint);
|
os_text(&events, event->window, codepoint);
|
||||||
os_eat_event(&events, event);
|
os_eat_event(&events, event);
|
||||||
rd_cmd(rd_cfg_src_write_cmd_kind_table[RD_CfgSrc_User]);
|
rd_cmd(rd_cfg_src_write_cmd_kind_table[RD_CfgSrc_User]);
|
||||||
rd_request_frame();
|
rd_request_frame();
|
||||||
@@ -10891,12 +10893,20 @@ rd_frame(void)
|
|||||||
String8List spec_candidates = rd_cmd_name_list_from_binding(scratch.arena, binding);
|
String8List spec_candidates = rd_cmd_name_list_from_binding(scratch.arena, binding);
|
||||||
if(spec_candidates.first != 0)
|
if(spec_candidates.first != 0)
|
||||||
{
|
{
|
||||||
rd_cmd(RD_CmdKind_RunCommand, .string = spec_candidates.first->string);
|
|
||||||
U32 hit_char = os_codepoint_from_modifiers_and_key(event->modifiers, event->key);
|
U32 hit_char = os_codepoint_from_modifiers_and_key(event->modifiers, event->key);
|
||||||
take = 1;
|
if(hit_char == 0 || allow_text_hotkeys)
|
||||||
if(event->modifiers & OS_Modifier_Alt)
|
|
||||||
{
|
{
|
||||||
window->menu_bar_focus_press_started = 0;
|
rd_cmd(RD_CmdKind_RunCommand, .string = spec_candidates.first->string);
|
||||||
|
if(allow_text_hotkeys)
|
||||||
|
{
|
||||||
|
os_text(&events, event->window, hit_char);
|
||||||
|
next = event->next;
|
||||||
|
}
|
||||||
|
take = 1;
|
||||||
|
if(event->modifiers & OS_Modifier_Alt)
|
||||||
|
{
|
||||||
|
window->menu_bar_focus_press_started = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(OS_Key_F1 <= event->key && event->key <= OS_Key_F19)
|
else if(OS_Key_F1 <= event->key && event->key <= OS_Key_F19)
|
||||||
|
|||||||
@@ -811,6 +811,9 @@ struct RD_State
|
|||||||
String8 popup_title;
|
String8 popup_title;
|
||||||
String8 popup_desc;
|
String8 popup_desc;
|
||||||
|
|
||||||
|
// rjf: text editing mode state
|
||||||
|
B32 text_edit_mode;
|
||||||
|
|
||||||
// rjf: string search state
|
// rjf: string search state
|
||||||
Arena *string_search_arena;
|
Arena *string_search_arena;
|
||||||
String8 string_search_string;
|
String8 string_search_string;
|
||||||
|
|||||||
@@ -1584,6 +1584,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
|||||||
B32 editing_complete = ((evt->kind == UI_EventKind_Press && (evt->slot == UI_EventActionSlot_Cancel || evt->slot == UI_EventActionSlot_Accept)) ||
|
B32 editing_complete = ((evt->kind == UI_EventKind_Press && (evt->slot == UI_EventActionSlot_Cancel || evt->slot == UI_EventActionSlot_Accept)) ||
|
||||||
(evt->kind == UI_EventKind_Navigate && evt->delta_2s32.y != 0) ||
|
(evt->kind == UI_EventKind_Navigate && evt->delta_2s32.y != 0) ||
|
||||||
cursor_rugpull);
|
cursor_rugpull);
|
||||||
|
rd_state->text_edit_mode = 1;
|
||||||
if(editing_complete ||
|
if(editing_complete ||
|
||||||
((evt->kind == UI_EventKind_Edit ||
|
((evt->kind == UI_EventKind_Edit ||
|
||||||
evt->kind == UI_EventKind_Navigate ||
|
evt->kind == UI_EventKind_Navigate ||
|
||||||
|
|||||||
@@ -3028,6 +3028,7 @@ rd_line_edit(RD_LineEditFlags flags, S32 depth, FuzzyMatchRangeList *matches, Tx
|
|||||||
if(!(flags & RD_LineEditFlag_DisableEdit) && (is_focus_active || focus_started))
|
if(!(flags & RD_LineEditFlag_DisableEdit) && (is_focus_active || focus_started))
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
|
rd_state->text_edit_mode = 1;
|
||||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||||
{
|
{
|
||||||
String8 edit_string = str8(edit_buffer, edit_string_size_out[0]);
|
String8 edit_string = str8(edit_buffer, edit_string_size_out[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user