Run variable dump on config apply; fix bugs in variable dump

This commit is contained in:
Allen Webster 2020-11-24 18:04:46 -08:00
parent 6cd965ffbe
commit a541d4b4c9
3 changed files with 10 additions and 3 deletions

View File

@ -1418,6 +1418,8 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
if (parsed != 0){ if (parsed != 0){
success = true; success = true;
config_fixed_string_var(parsed, "user_name", 0, config_fixed_string_var(parsed, "user_name", 0,
&config->user_name, config->user_name_space); &config->user_name, config->user_name_space);
@ -1669,6 +1671,11 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
if (error_text.str != 0){ if (error_text.str != 0){
print_message(app, error_text); print_message(app, error_text);
} }
// NOTE(allen): Save As Variables
if (error_text.str == 0){
def_var_from_config(app, vars_get_root(), string_litinit("config"), parsed);
}
} }
else{ else{
print_message(app, string_u8_litexpr("Using default config:\n")); print_message(app, string_u8_litexpr("Using default config:\n"));

View File

@ -202,7 +202,7 @@ vars_new_variable(Variable_Handle var, String_ID key){
} }
else{ else{
handle.ptr = vars_free_variables; handle.ptr = vars_free_variables;
if (handle.ptr == 0){ if (handle.ptr != 0){
sll_stack_pop(vars_free_variables); sll_stack_pop(vars_free_variables);
} }
else{ else{
@ -222,7 +222,7 @@ vars_new_variable(Variable_Handle var, String_ID key){
function Variable_Handle function Variable_Handle
vars_new_variable(Variable_Handle var, String_ID key, String_ID string){ vars_new_variable(Variable_Handle var, String_ID key, String_ID string){
Variable_Handle result = vars_new_variable(var, key); Variable_Handle result = vars_new_variable(var, key);
vars_set_string(var, string); vars_set_string(result, string);
return(result); return(result);
} }

View File

@ -372,7 +372,7 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 174 }, { PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 174 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 186 }, { PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 186 },
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 867 }, { PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 867 },
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1797 }, { PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1805 },
{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 533 }, { PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 533 },
{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 545 }, { PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 545 },
{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1493 }, { PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1493 },