Bindings favorable to mac keyboard now working
This commit is contained in:
parent
33aa987589
commit
bd3417e836
|
@ -1196,6 +1196,7 @@ config_init_default(Config_Data *config){
|
|||
|
||||
block_zero_struct(&config->code_exts);
|
||||
|
||||
config->mapping = SCu8(config->mapping_space, (u64)0);
|
||||
config->mode = SCu8(config->mode_space, (u64)0);
|
||||
|
||||
config->use_scroll_bars = false;
|
||||
|
@ -1211,7 +1212,6 @@ config_init_default(Config_Data *config){
|
|||
|
||||
config->enable_virtual_whitespace = true;
|
||||
config->enable_code_wrapping = true;
|
||||
config->automatically_adjust_wrapping = true;
|
||||
config->automatically_indent_text_on_save = true;
|
||||
config->automatically_save_changes_on_build = true;
|
||||
config->automatically_load_project = false;
|
||||
|
@ -1219,9 +1219,6 @@ config_init_default(Config_Data *config){
|
|||
config->indent_with_tabs = false;
|
||||
config->indent_width = 4;
|
||||
|
||||
config->default_wrap_width = 672;
|
||||
config->default_min_base_width = 550;
|
||||
|
||||
config->default_theme_name = SCu8(config->default_theme_name_space, sizeof("4coder") - 1);
|
||||
block_copy(config->default_theme_name.str, "4coder", config->default_theme_name.size);
|
||||
config->highlight_line_at_cursor = true;
|
||||
|
@ -1263,8 +1260,8 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
|
|||
parse_extension_line_to_extension_list(app, arena, str);
|
||||
}
|
||||
|
||||
config_fixed_string_var(parsed, "mode", 0,
|
||||
&config->mode, config->mode_space);
|
||||
config_fixed_string_var(parsed, "mapping", 0, &config->mapping, config->mapping_space);
|
||||
config_fixed_string_var(parsed, "mode", 0, &config->mode, config->mode_space);
|
||||
|
||||
config_bool_var(parsed, "use_scroll_bars", 0, &config->use_scroll_bars);
|
||||
config_bool_var(parsed, "use_file_bars", 0, &config->use_file_bars);
|
||||
|
@ -1280,7 +1277,6 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
|
|||
|
||||
config_bool_var(parsed, "enable_virtual_whitespace", 0, &config->enable_virtual_whitespace);
|
||||
config_bool_var(parsed, "enable_code_wrapping", 0, &config->enable_code_wrapping);
|
||||
config_bool_var(parsed, "automatically_adjust_wrapping", 0, &config->automatically_adjust_wrapping);
|
||||
config_bool_var(parsed, "automatically_indent_text_on_save", 0, &config->automatically_indent_text_on_save);
|
||||
config_bool_var(parsed, "automatically_save_changes_on_build", 0, &config->automatically_save_changes_on_build);
|
||||
config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project);
|
||||
|
@ -1288,9 +1284,6 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
|
|||
config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs);
|
||||
config_int_var(parsed, "indent_width", 0, &config->indent_width);
|
||||
|
||||
config_int_var(parsed, "default_wrap_width", 0, &config->default_wrap_width);
|
||||
config_int_var(parsed, "default_min_base_width", 0, &config->default_min_base_width);
|
||||
|
||||
config_fixed_string_var(parsed, "default_theme_name", 0,
|
||||
&config->default_theme_name, config->default_theme_name_space);
|
||||
config_bool_var(parsed, "highlight_line_at_cursor", 0, &config->highlight_line_at_cursor);
|
||||
|
@ -1505,6 +1498,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
|
|||
config_feedback_string(scratch, &list, "user_name", config->user_name);
|
||||
config_feedback_extension_list(scratch, &list, "treat_as_code", &config->code_exts);
|
||||
|
||||
config_feedback_string(scratch, &list, "mapping", config->mapping);
|
||||
config_feedback_string(scratch, &list, "mode", config->mode);
|
||||
|
||||
config_feedback_bool(scratch, &list, "use_scroll_bars", config->use_scroll_bars);
|
||||
|
@ -1522,15 +1516,11 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
|
|||
config_feedback_bool(scratch, &list, "enable_code_wrapping", config->enable_code_wrapping);
|
||||
config_feedback_bool(scratch, &list, "automatically_indent_text_on_save", config->automatically_indent_text_on_save);
|
||||
config_feedback_bool(scratch, &list, "automatically_save_changes_on_build", config->automatically_save_changes_on_build);
|
||||
config_feedback_bool(scratch, &list, "automatically_adjust_wrapping", config->automatically_adjust_wrapping);
|
||||
config_feedback_bool(scratch, &list, "automatically_load_project", config->automatically_load_project);
|
||||
|
||||
config_feedback_bool(scratch, &list, "indent_with_tabs", config->indent_with_tabs);
|
||||
config_feedback_int(scratch, &list, "indent_width", config->indent_width);
|
||||
|
||||
config_feedback_int(scratch, &list, "default_wrap_width", config->default_wrap_width);
|
||||
config_feedback_int(scratch, &list, "default_min_base_width", config->default_min_base_width);
|
||||
|
||||
config_feedback_string(scratch, &list, "default_theme_name", config->default_theme_name);
|
||||
config_feedback_bool(scratch, &list, "highlight_line_at_cursor", config->highlight_line_at_cursor);
|
||||
|
||||
|
@ -1552,6 +1542,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
|
|||
}
|
||||
|
||||
// Apply config
|
||||
setup_built_in_mapping(app, config->mapping, &framework_mapping, mapid_global, mapid_file, mapid_code);
|
||||
change_mode(app, config->mode);
|
||||
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr);
|
||||
|
||||
|
|
|
@ -185,6 +185,9 @@ struct Config_Data{
|
|||
|
||||
String_Const_u8_Array code_exts;
|
||||
|
||||
u8 mapping_space[64];
|
||||
String_Const_u8 mapping;
|
||||
|
||||
u8 mode_space[64];
|
||||
String_Const_u8 mode;
|
||||
|
||||
|
@ -203,15 +206,11 @@ struct Config_Data{
|
|||
b8 enable_code_wrapping;
|
||||
b8 automatically_indent_text_on_save;
|
||||
b8 automatically_save_changes_on_build;
|
||||
b8 automatically_adjust_wrapping;
|
||||
b8 automatically_load_project;
|
||||
|
||||
b8 indent_with_tabs;
|
||||
i32 indent_width;
|
||||
|
||||
i32 default_wrap_width;
|
||||
i32 default_min_base_width;
|
||||
|
||||
u8 default_theme_name_space[256];
|
||||
String_Const_u8 default_theme_name;
|
||||
|
||||
|
|
|
@ -34,6 +34,30 @@ custom_layer_init(Application_Links *app){
|
|||
setup_default_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code);
|
||||
}
|
||||
|
||||
function void
|
||||
setup_built_in_mapping(Application_Links *app, String_Const_u8 name, Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
|
||||
Thread_Context *tctx = get_thread_context(app);
|
||||
if (string_match(name, string_u8_litexpr("default"))){
|
||||
mapping_release(tctx, mapping);
|
||||
mapping_init(tctx, mapping);
|
||||
setup_default_mapping(mapping, global_id, file_id, code_id);
|
||||
}
|
||||
else if (string_match(name, string_u8_litexpr("mac-default"))){
|
||||
mapping_release(tctx, mapping);
|
||||
mapping_init(tctx, mapping);
|
||||
setup_mac_mapping(mapping, global_id, file_id, code_id);
|
||||
}
|
||||
else if (string_match(name, string_u8_litexpr("choose"))){
|
||||
mapping_release(tctx, mapping);
|
||||
mapping_init(tctx, mapping);
|
||||
#if OS_MAC
|
||||
setup_mac_mapping(mapping, global_id, file_id, code_id);
|
||||
#else
|
||||
setup_default_mapping(mapping, global_id, file_id, code_id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif //FCODER_DEFAULT_BINDINGS
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -114,6 +114,11 @@ struct Fade_Range_List{
|
|||
i32 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
function void
|
||||
setup_built_in_mapping(Application_Links *app, String_Const_u8 name, Mapping *mapping, i64 global_id, i64 file_id, i64 code_id);
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -52,7 +52,7 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
|
|||
Bind(project_fkey_command, KeyCode_F14);
|
||||
Bind(project_fkey_command, KeyCode_F15);
|
||||
Bind(project_fkey_command, KeyCode_F16);
|
||||
Bind(exit_4coder, KeyCode_F4, KeyCode_Control);
|
||||
Bind(exit_4coder, KeyCode_F4, KeyCode_Alt);
|
||||
BindMouseWheel(mouse_wheel_scroll);
|
||||
BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Command);
|
||||
|
||||
|
@ -79,13 +79,13 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
|
|||
Bind(move_down_to_blank_line_end, KeyCode_Down, KeyCode_Command);
|
||||
Bind(move_left_whitespace_boundary, KeyCode_Left, KeyCode_Command);
|
||||
Bind(move_right_whitespace_boundary, KeyCode_Right, KeyCode_Command);
|
||||
Bind(move_line_up, KeyCode_Up, KeyCode_Control);
|
||||
Bind(move_line_down, KeyCode_Down, KeyCode_Control);
|
||||
Bind(move_line_up, KeyCode_Up, KeyCode_Alt);
|
||||
Bind(move_line_down, KeyCode_Down, KeyCode_Alt);
|
||||
Bind(backspace_alpha_numeric_boundary, KeyCode_Backspace, KeyCode_Command);
|
||||
Bind(delete_alpha_numeric_boundary, KeyCode_Delete, KeyCode_Command);
|
||||
Bind(snipe_backward_whitespace_or_token_boundary, KeyCode_Backspace, KeyCode_Control);
|
||||
Bind(snipe_forward_whitespace_or_token_boundary, KeyCode_Delete, KeyCode_Control);
|
||||
Bind(set_mark, KeyCode_Space, KeyCode_Command);
|
||||
Bind(set_mark, KeyCode_Space, KeyCode_Control);
|
||||
Bind(replace_in_range, KeyCode_A, KeyCode_Command);
|
||||
Bind(copy, KeyCode_C, KeyCode_Command);
|
||||
Bind(delete_range, KeyCode_D, KeyCode_Command);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Command Mapping
|
||||
// "" - Leave the bindings unaltered from their startup value.
|
||||
// "" - Leave the bindings unaltered.
|
||||
// "choose" - Ask 4coder to choose based on platform.
|
||||
// "default" - Use the default keybindings 4coder has always had.
|
||||
// "mac-default" - Use keybindings similar to those found in other Mac applications.
|
||||
|
@ -25,9 +25,6 @@ show_line_number_margins = false;
|
|||
treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm";
|
||||
enable_virtual_whitespace = true;
|
||||
enable_code_wrapping = true;
|
||||
automatically_adjust_wrapping = true;
|
||||
default_wrap_width = 672;
|
||||
default_min_base_width = 550;
|
||||
|
||||
// This only applies to code files in code-wrapping mode.
|
||||
// Plain text and code files without virtual-whitespace will not be effected.
|
||||
|
|
Loading…
Reference in New Issue