Bindings favorable to mac keyboard now working

master
Allen Webster 2020-01-19 13:30:28 -08:00
parent 33aa987589
commit bd3417e836
6 changed files with 1643 additions and 1627 deletions

File diff suppressed because it is too large Load Diff

View File

@ -185,6 +185,9 @@ struct Config_Data{
String_Const_u8_Array code_exts; String_Const_u8_Array code_exts;
u8 mapping_space[64];
String_Const_u8 mapping;
u8 mode_space[64]; u8 mode_space[64];
String_Const_u8 mode; String_Const_u8 mode;
@ -203,15 +206,11 @@ struct Config_Data{
b8 enable_code_wrapping; b8 enable_code_wrapping;
b8 automatically_indent_text_on_save; b8 automatically_indent_text_on_save;
b8 automatically_save_changes_on_build; b8 automatically_save_changes_on_build;
b8 automatically_adjust_wrapping;
b8 automatically_load_project; b8 automatically_load_project;
b8 indent_with_tabs; b8 indent_with_tabs;
i32 indent_width; i32 indent_width;
i32 default_wrap_width;
i32 default_min_base_width;
u8 default_theme_name_space[256]; u8 default_theme_name_space[256];
String_Const_u8 default_theme_name; String_Const_u8 default_theme_name;

View File

@ -34,6 +34,30 @@ custom_layer_init(Application_Links *app){
setup_default_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); 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 #endif //FCODER_DEFAULT_BINDINGS
// BOTTOM // BOTTOM

View File

@ -114,6 +114,11 @@ struct Fade_Range_List{
i32 count; 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 #endif
// BOTTOM // BOTTOM

View File

@ -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_F14);
Bind(project_fkey_command, KeyCode_F15); Bind(project_fkey_command, KeyCode_F15);
Bind(project_fkey_command, KeyCode_F16); 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_scroll);
BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Command); 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_down_to_blank_line_end, KeyCode_Down, KeyCode_Command);
Bind(move_left_whitespace_boundary, KeyCode_Left, KeyCode_Command); Bind(move_left_whitespace_boundary, KeyCode_Left, KeyCode_Command);
Bind(move_right_whitespace_boundary, KeyCode_Right, KeyCode_Command); Bind(move_right_whitespace_boundary, KeyCode_Right, KeyCode_Command);
Bind(move_line_up, KeyCode_Up, KeyCode_Control); Bind(move_line_up, KeyCode_Up, KeyCode_Alt);
Bind(move_line_down, KeyCode_Down, KeyCode_Control); Bind(move_line_down, KeyCode_Down, KeyCode_Alt);
Bind(backspace_alpha_numeric_boundary, KeyCode_Backspace, KeyCode_Command); Bind(backspace_alpha_numeric_boundary, KeyCode_Backspace, KeyCode_Command);
Bind(delete_alpha_numeric_boundary, KeyCode_Delete, KeyCode_Command); Bind(delete_alpha_numeric_boundary, KeyCode_Delete, KeyCode_Command);
Bind(snipe_backward_whitespace_or_token_boundary, KeyCode_Backspace, KeyCode_Control); Bind(snipe_backward_whitespace_or_token_boundary, KeyCode_Backspace, KeyCode_Control);
Bind(snipe_forward_whitespace_or_token_boundary, KeyCode_Delete, 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(replace_in_range, KeyCode_A, KeyCode_Command);
Bind(copy, KeyCode_C, KeyCode_Command); Bind(copy, KeyCode_C, KeyCode_Command);
Bind(delete_range, KeyCode_D, KeyCode_Command); Bind(delete_range, KeyCode_D, KeyCode_Command);

View File

@ -1,5 +1,5 @@
// Command Mapping // Command Mapping
// "" - Leave the bindings unaltered from their startup value. // "" - Leave the bindings unaltered.
// "choose" - Ask 4coder to choose based on platform. // "choose" - Ask 4coder to choose based on platform.
// "default" - Use the default keybindings 4coder has always had. // "default" - Use the default keybindings 4coder has always had.
// "mac-default" - Use keybindings similar to those found in other Mac applications. // "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"; treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm";
enable_virtual_whitespace = true; enable_virtual_whitespace = true;
enable_code_wrapping = 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. // This only applies to code files in code-wrapping mode.
// Plain text and code files without virtual-whitespace will not be effected. // Plain text and code files without virtual-whitespace will not be effected.