Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ALT overriding text input #59

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/df/gfx/df_views.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,15 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
}

// check if edit is still live and focus is on the same panel
if(ui_is_focus_active())
{
ui_state->is_editing = ewv->input_editing;
}
else if(ewv->input_editing)
{
ui_state->is_editing = 0;
}
//////////////////////////////
//- rjf: build ui
//
Expand Down Expand Up @@ -1565,6 +1574,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
if(edit_end)
{
ewv->input_editing = 0;
ui_state->is_editing = 0;
}

//////////////////////////////
Expand Down Expand Up @@ -2943,6 +2953,16 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
}
}
}

// check if edit is still live and focus is on the same panel
if(ui_is_focus_active())
{
ui_state->is_editing = tv->input_editing;
}
else if(tv->input_editing)
{
ui_state->is_editing = 0;
}

//- rjf: build
Rng1S64 visible_row_range = {0};
Expand Down Expand Up @@ -3113,6 +3133,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
if(edit_end)
{
tv->input_editing = 0;
ui_state->is_editing = 0;
}
if(edit_submit)
{
Expand Down Expand Up @@ -3393,6 +3414,16 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
}
}
}

// check if edit is still live and focus is on the same panel
if(ui_is_focus_active())
{
ui_state->is_editing = fpms->input_editing;
}
else if(fpms->input_editing)
{
ui_state->is_editing = 0;
}

//- rjf: build
DF_Handle commit_map = df_handle_zero();
Expand Down Expand Up @@ -3603,6 +3634,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
if(edit_end)
{
fpms->input_editing = 0;
ui_state->is_editing = 0;
}

//- rjf: move down one row if submitted
Expand Down Expand Up @@ -4181,6 +4213,16 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
edit_submit = 1;
}
}

// check if edit is still live and focus is on the same panel
if(ui_is_focus_active())
{
ui_state->is_editing = mv->txt_editing;
}
else if(mv->txt_editing)
{
ui_state->is_editing = 0;
}

//- rjf: build table
DF_Entity *commit_module = &df_g_nil_entity;
Expand Down Expand Up @@ -4338,6 +4380,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
if(edit_end)
{
mv->txt_editing = 0;
ui_state->is_editing = 0;
}

//- rjf: selected num -> selected entity
Expand Down
16 changes: 15 additions & 1 deletion src/raddbg/raddbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,21 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
{
next = event->next;
DF_Window *ws = df_window_from_os_handle(event->window);
if(ws == 0)
DF_CmdQueryRule query_rule = DF_CmdQueryRule_Null;
// check if focused panel has an active command query
{
DF_Panel *panel = ws->focused_panel;
if(!df_panel_is_nil(panel))
{
DF_View *view = df_selected_view_from_panel(panel);
if(!df_view_is_nil(view))
{
query_rule = view->cmd_spec->info.query_rule;
}
}
}

if(ws == 0 || ui_state->is_editing || query_rule != DF_CmdQueryRule_Null)
{
continue;
}
Expand Down
1 change: 1 addition & 0 deletions src/ui/ui_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ struct UI_State
Vec2F32 drag_start_mouse;
Arena *drag_state_arena;
String8 drag_state_data;
B32 is_editing;

//- rjf: context menu state
UI_Key ctx_menu_anchor_key;
Expand Down