Move user_name over to new config system
parent
07b6b85ac9
commit
a6c307944f
|
@ -4,24 +4,24 @@
|
|||
|
||||
// TOP
|
||||
|
||||
static void
|
||||
function void
|
||||
write_string(Application_Links *app, View_ID view, Buffer_ID buffer, String_Const_u8 string){
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), string);
|
||||
view_set_cursor_and_preferred_x(app, view, seek_pos(pos + string.size));
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
write_string(Application_Links *app, String_Const_u8 string){
|
||||
View_ID view = get_active_view(app, Access_ReadWriteVisible);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
|
||||
write_string(app, view, buffer, string);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
write_named_comment_string(Application_Links *app, char *type_string){
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 name = global_config.user_name;
|
||||
String_Const_u8 name = def_get_config_string(scratch, vars_save_string_lit("user_name"));
|
||||
String_Const_u8 str = {};
|
||||
if (name.size > 0){
|
||||
str = push_u8_stringf(scratch, "// %s(%.*s): ", type_string, string_expand(name));
|
||||
|
@ -32,7 +32,7 @@ write_named_comment_string(Application_Links *app, char *type_string){
|
|||
write_string(app, str);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
long_braces(Application_Links *app, char *text, i32 size){
|
||||
View_ID view = get_active_view(app, Access_ReadWriteVisible);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
|
||||
|
|
|
@ -797,6 +797,19 @@ def_set_config_b32(String_ID key, b32 val){
|
|||
def_set_config_var(key, val_id);
|
||||
}
|
||||
|
||||
function String_Const_u8
|
||||
def_get_config_string(Arena *arena, String_ID key){
|
||||
Variable_Handle var = def_get_config_var(key);
|
||||
String_ID val = vars_string_id_from_var(var);
|
||||
String_Const_u8 result = vars_read_string(arena, val);
|
||||
return(result);
|
||||
}
|
||||
|
||||
function void
|
||||
def_set_config_string(String_ID key, String_Const_u8 val){
|
||||
def_set_config_var(key, vars_save_string(val) );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Eval
|
||||
|
@ -1325,8 +1338,6 @@ change_mode(Application_Links *app, String_Const_u8 mode){
|
|||
|
||||
function void
|
||||
config_init_default(Config_Data *config){
|
||||
config->user_name = SCu8(config->user_name_space, (u64)0);
|
||||
|
||||
block_zero_struct(&config->code_exts);
|
||||
|
||||
config->mapping = SCu8(config->mapping_space, (u64)0);
|
||||
|
@ -1369,11 +1380,6 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
|
|||
if (parsed != 0){
|
||||
success = true;
|
||||
|
||||
|
||||
|
||||
config_fixed_string_var(parsed, "user_name", 0,
|
||||
&config->user_name, config->user_name_space);
|
||||
|
||||
String_Const_u8 str = {};
|
||||
if (config_string_var(parsed, "treat_as_code", 0, &str)){
|
||||
config->code_exts =
|
||||
|
|
|
@ -178,9 +178,6 @@ struct Config_Get_Result_List{
|
|||
// NOTE(allen): Config Data Type
|
||||
|
||||
struct Config_Data{
|
||||
u8 user_name_space[256];
|
||||
String_Const_u8 user_name;
|
||||
|
||||
String_Const_u8_Array code_exts;
|
||||
|
||||
u8 mapping_space[64];
|
||||
|
@ -273,6 +270,9 @@ function void def_set_config_var(String_ID key, String_ID val);
|
|||
function b32 def_get_config_b32(String_ID key);
|
||||
function void def_set_config_b32(String_ID key, b32 val);
|
||||
|
||||
function String_Const_u8 def_get_config_string(Arena *arena, String_ID key);
|
||||
function void def_set_config_string(String_ID key, String_Const_u8 val);
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -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_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, 963 },
|
||||
{ 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, 1646 },
|
||||
{ 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, 1652 },
|
||||
{ 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, 535 },
|
||||
{ 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, 547 },
|
||||
{ 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, 1495 },
|
||||
|
|
|
@ -69,7 +69,7 @@ default_font_size = 16;
|
|||
default_font_hinting = false;
|
||||
|
||||
// User
|
||||
user_name = "unset";
|
||||
user_name = "not-set";
|
||||
|
||||
// Keyboard AltGr setting
|
||||
lalt_lctrl_is_altgr = false;
|
||||
|
|
Loading…
Reference in New Issue