diff --git a/custom/4coder_project_commands.cpp b/custom/4coder_project_commands.cpp index 7056c3ad..0148ccc3 100644 --- a/custom/4coder_project_commands.cpp +++ b/custom/4coder_project_commands.cpp @@ -1378,9 +1378,9 @@ CUSTOM_DOC("Queries the user for several configuration options and initializes a /////////////////////////////// -function Project_Command_Lister_Result +function Variable_Handle get_project_command_from_user(Application_Links *app, Project *project, String_Const_u8 query){ - Project_Command_Lister_Result result = {}; + Variable_Handle result = vars_get_nil(); if (project != 0){ Scratch_Block scratch(app); Lister_Block lister(app, scratch); @@ -1395,30 +1395,23 @@ get_project_command_from_user(Application_Links *app, Project *project, String_C Lister_Result l_result = run_lister(app, lister); if (!l_result.canceled){ - result.success = true; Project_Command *result_proj_cmd = (Project_Command*)l_result.user_data; String_Const_u8 cmd_name = prj_sanitize_string(scratch, result_proj_cmd->name); - result.cmd = prj_command_from_name(app, cmd_name); + result = prj_command_from_name(app, cmd_name); } } return(result); } - -function Project_Command_Lister_Result -get_project_command_from_user(Application_Links *app, Project *project, char *query){ - return(get_project_command_from_user(app, project, SCu8(query))); -} - CUSTOM_COMMAND_SIG(project_command_lister) CUSTOM_DOC("Open a lister of all commands in the currently loaded project.") { if (current_project.loaded){ - Project_Command_Lister_Result proj_cmd = - get_project_command_from_user(app, ¤t_project, "Command:"); - if (proj_cmd.success){ - prj_exec_command(app, proj_cmd.cmd); + Variable_Handle proj_cmd = + get_project_command_from_user(app, ¤t_project, string_u8_litexpr("Command:")); + if (!vars_is_nil(proj_cmd)){ + prj_exec_command(app, proj_cmd); } } } diff --git a/custom/4coder_project_commands.h b/custom/4coder_project_commands.h index 5b7a930c..538e9afb 100644 --- a/custom/4coder_project_commands.h +++ b/custom/4coder_project_commands.h @@ -91,13 +91,6 @@ struct Project_Key_Strings{ String_Const_u8 binary_file; }; -/////////////////////////////// - -struct Project_Command_Lister_Result{ - b32 success; - Variable_Handle cmd; -}; - #endif // BOTTOM diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index 308ba110..8378207b 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -436,7 +436,7 @@ static Command_Metadata fcoder_metacmd_table[250] = { { PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 219 }, { PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 212 }, { PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "W:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 886 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1414 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1407 }, { PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 993 }, { PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1019 }, { PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1282 },