[dynamic bindings] fixing bugs; got it working

master
Allen Webster 2020-10-22 19:36:17 -07:00
parent 8915bcceba
commit fe8acba488
15 changed files with 490 additions and 51 deletions

View File

@ -139,15 +139,6 @@ map__init(Mapping *mapping, Command_Map *map, Command_Map_ID id){
map->cmd_to_binding_trigger = make_table_u64_u64(&mapping->heap_wrapper, 100); map->cmd_to_binding_trigger = make_table_u64_u64(&mapping->heap_wrapper, 100);
} }
function Command_Map*
mapping_begin_new_map(Mapping *mapping){
Command_Map *map = mapping__alloc_map(mapping);
map__init(mapping, map, mapping->id_counter);
mapping->id_counter += 1;
table_insert(&mapping->id_to_map, map->id, (u64)PtrAsInt(map));
return(map);
}
function Command_Map* function Command_Map*
mapping_get_map(Mapping *mapping, Command_Map_ID id){ mapping_get_map(Mapping *mapping, Command_Map_ID id){
Command_Map *result = 0; Command_Map *result = 0;
@ -175,7 +166,7 @@ mapping_get_or_make_map(Mapping *mapping, Command_Map_ID id){
if (result == 0){ if (result == 0){
result = mapping__alloc_map(mapping); result = mapping__alloc_map(mapping);
map__init(mapping, result, id); map__init(mapping, result, id);
table_insert(&mapping->id_to_map, result->id, (u64)PtrAsInt(result)); table_insert(&mapping->id_to_map, id, (u64)PtrAsInt(result));
} }
return(result); return(result);
} }

View File

@ -1617,7 +1617,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
} }
// Apply config // Apply config
setup_built_in_mapping(app, config->mapping, &framework_mapping, mapid_global, mapid_file, mapid_code); //setup_built_in_mapping(app, config->mapping, &framework_mapping, mapid_global, mapid_file, mapid_code);
change_mode(app, config->mode); change_mode(app, config->mode);
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr); global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr);

View File

@ -25,11 +25,15 @@ custom_layer_init(Application_Links *app){
// NOTE(allen): default hooks and command maps // NOTE(allen): default hooks and command maps
set_all_default_hooks(app); set_all_default_hooks(app);
mapping_init(tctx, &framework_mapping); mapping_init(tctx, &framework_mapping);
String_ID global_map_id = vars_save_string_lit("keys_global");
String_ID file_map_id = vars_save_string_lit("keys_file");
String_ID code_map_id = vars_save_string_lit("keys_code");
#if OS_MAC #if OS_MAC
setup_mac_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); setup_mac_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#else #else
setup_default_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); setup_default_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#endif #endif
setup_essential_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
} }
#endif //FCODER_DEFAULT_BINDINGS #endif //FCODER_DEFAULT_BINDINGS

View File

@ -569,6 +569,31 @@ CUSTOM_DOC("Clear the theme list")
//////////////////////////////// ////////////////////////////////
function void
setup_essential_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
MappingScope();
SelectMapping(mapping);
SelectMap(global_id);
BindCore(default_startup, CoreCode_Startup);
BindCore(default_try_exit, CoreCode_TryExit);
BindCore(clipboard_record_clip, CoreCode_NewClipboardContents);
BindMouseWheel(mouse_wheel_scroll);
BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Control);
SelectMap(file_id);
ParentMap(global_id);
BindTextInput(write_text_input);
BindMouse(click_set_cursor_and_mark, MouseCode_Left);
BindMouseRelease(click_set_cursor, MouseCode_Left);
BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView);
BindMouseMove(click_set_cursor_if_lbutton);
SelectMap(code_id);
ParentMap(file_id);
BindTextInput(write_text_and_auto_indent);
}
function void function void
default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_names, default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_names,
i32 override_font_size, b32 override_hinting){ i32 override_font_size, b32 override_hinting){
@ -589,6 +614,26 @@ default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_nam
load_config_and_apply(app, &global_config_arena, &global_config, override_font_size, override_hinting); load_config_and_apply(app, &global_config_arena, &global_config, override_font_size, override_hinting);
String_Const_u8 bindings_file_name = string_u8_litexpr("bindings.4coder");
if (string_match(global_config.mapping, string_u8_litexpr("mac-default"))){
bindings_file_name = string_u8_litexpr("mac-bindings.4coder");
}
else if (OS_MAC && string_match(global_config.mapping, string_u8_litexpr("choose"))){
bindings_file_name = string_u8_litexpr("mac-bindings.4coder");
}
// TODO(allen): cleanup
String_ID global_map_id = vars_save_string_lit("keys_global");
String_ID file_map_id = vars_save_string_lit("keys_file");
String_ID code_map_id = vars_save_string_lit("keys_code");
if (dynamic_binding_load_from_file(app, &framework_mapping, bindings_file_name)){
setup_essential_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
}
else{
setup_built_in_mapping(app, global_config.mapping, &framework_mapping, global_map_id, file_map_id, code_map_id);
}
// open command line files // open command line files
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 hot_directory = push_hot_directory(app, scratch); String_Const_u8 hot_directory = push_hot_directory(app, scratch);
@ -987,7 +1032,7 @@ default_input_handler_init(Application_Links *app, Arena *arena){
View_Context ctx = view_current_context(app, view); View_Context ctx = view_current_context(app, view);
ctx.mapping = &framework_mapping; ctx.mapping = &framework_mapping;
ctx.map_id = mapid_global; ctx.map_id = vars_save_string_lit("keys_global");
view_alter_context(app, view, &ctx); view_alter_context(app, view, &ctx);
} }
@ -999,12 +1044,12 @@ default_get_map_id(Application_Links *app, View_ID view){
Command_Map_ID *result_ptr = scope_attachment(app, buffer_scope, buffer_map_id, Command_Map_ID); Command_Map_ID *result_ptr = scope_attachment(app, buffer_scope, buffer_map_id, Command_Map_ID);
if (result_ptr != 0){ if (result_ptr != 0){
if (*result_ptr == 0){ if (*result_ptr == 0){
*result_ptr = mapid_file; *result_ptr = vars_save_string_lit("keys_file");
} }
result = *result_ptr; result = *result_ptr;
} }
else{ else{
result = mapid_global; result = vars_save_string_lit("keys_global");
} }
return(result); return(result);
} }

View File

@ -28,9 +28,11 @@ CUSTOM_ID(attachment, attachment_tokens);
//////////////////////////////// ////////////////////////////////
#if 0
CUSTOM_ID(command_map, mapid_global); CUSTOM_ID(command_map, mapid_global);
CUSTOM_ID(command_map, mapid_file); CUSTOM_ID(command_map, mapid_file);
CUSTOM_ID(command_map, mapid_code); CUSTOM_ID(command_map, mapid_code);
#endif
//////////////////////////////// ////////////////////////////////

View File

@ -772,7 +772,10 @@ BUFFER_HOOK_SIG(default_begin_buffer){
} }
} }
Command_Map_ID map_id = (treat_as_code)?(mapid_code):(mapid_file); String_ID file_map_id = vars_save_string_lit("keys_file");
String_ID code_map_id = vars_save_string_lit("keys_code");
Command_Map_ID map_id = (treat_as_code)?(code_map_id):(file_map_id);
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
Command_Map_ID *map_id_ptr = scope_attachment(app, scope, buffer_map_id, Command_Map_ID); Command_Map_ID *map_id_ptr = scope_attachment(app, scope, buffer_map_id, Command_Map_ID);
*map_id_ptr = map_id; *map_id_ptr = map_id;

View File

@ -100,6 +100,7 @@
#include "4coder_draw.cpp" #include "4coder_draw.cpp"
#include "4coder_font_helper.cpp" #include "4coder_font_helper.cpp"
#include "4coder_config.cpp" #include "4coder_config.cpp"
#include "4coder_dynamic_bindings.cpp"
#include "4coder_default_framework.cpp" #include "4coder_default_framework.cpp"
#include "4coder_clipboard.cpp" #include "4coder_clipboard.cpp"
#include "4coder_lister_base.cpp" #include "4coder_lister_base.cpp"

View File

@ -10,9 +10,6 @@ setup_default_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id)
SelectMapping(mapping); SelectMapping(mapping);
SelectMap(global_id); SelectMap(global_id);
BindCore(default_startup, CoreCode_Startup);
BindCore(default_try_exit, CoreCode_TryExit);
BindCore(clipboard_record_clip, CoreCode_NewClipboardContents);
Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Control); Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Control);
Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Control, KeyCode_Shift); Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Control, KeyCode_Shift);
Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Alt); Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Alt);
@ -56,16 +53,8 @@ setup_default_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);
BindMouseWheel(mouse_wheel_scroll);
BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Control);
SelectMap(file_id); SelectMap(file_id);
ParentMap(global_id);
BindTextInput(write_text_input);
BindMouse(click_set_cursor_and_mark, MouseCode_Left);
BindMouseRelease(click_set_cursor, MouseCode_Left);
BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView);
BindMouseMove(click_set_cursor_if_lbutton);
Bind(delete_char, KeyCode_Delete); Bind(delete_char, KeyCode_Delete);
Bind(backspace_char, KeyCode_Backspace); Bind(backspace_char, KeyCode_Backspace);
Bind(move_up, KeyCode_Up); Bind(move_up, KeyCode_Up);
@ -126,7 +115,6 @@ setup_default_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id)
SelectMap(code_id); SelectMap(code_id);
ParentMap(file_id); ParentMap(file_id);
BindTextInput(write_text_and_auto_indent);
Bind(move_left_alpha_numeric_boundary, KeyCode_Left, KeyCode_Control); Bind(move_left_alpha_numeric_boundary, KeyCode_Left, KeyCode_Control);
Bind(move_right_alpha_numeric_boundary, KeyCode_Right, KeyCode_Control); Bind(move_right_alpha_numeric_boundary, KeyCode_Right, KeyCode_Control);
Bind(move_left_alpha_numeric_or_camel_boundary, KeyCode_Left, KeyCode_Alt); Bind(move_left_alpha_numeric_or_camel_boundary, KeyCode_Left, KeyCode_Alt);

View File

@ -0,0 +1,129 @@
/*
4coder_dynamic_bindings.cpp - Dynamic Bindings
*/
// TOP
function Key_Code
dynamic_binding_key_code_from_string(String_Const_u8 key_string){
Key_Code result = 0;
for (i32 i = 1; i < KeyCode_COUNT; i += 1){
String_Const_u8 str = SCu8(key_code_name[i]);
if (string_match(str, key_string)){
result = i;
break;
}
}
return result;
}
function b32
dynamic_binding_load_from_file(Application_Links *app, Mapping *mapping, String_Const_u8 filename){
b32 result = false;
Scratch_Block scratch(app);
String_Const_u8 filename_copied = push_string_copy(scratch, filename);
FILE *file = open_file_try_current_path_then_binary_path(app, (char*)filename_copied.str);
if (file != 0){
Data data = dump_file_handle(scratch, file);
Config *parsed = config_from_text(app, scratch, filename, SCu8(data));
fclose(file);
if (parsed != 0){
result = true;
Thread_Context* tctx = get_thread_context(app);
mapping_release(tctx, mapping);
mapping_init(tctx, mapping);
MappingScope();
SelectMapping(mapping);
for (Config_Assignment *assignment = parsed->first;
assignment != 0;
assignment = assignment->next){
Config_LValue *l = assignment->l;
if (l != 0 && l->index == 0){
Config_Get_Result rvalue = config_evaluate_rvalue(parsed, assignment, assignment->r);
if (rvalue.type == ConfigRValueType_Compound){
String_Const_u8 map_name = l->identifier;
String_ID map_name_id = vars_save_string(map_name);
SelectMap(map_name_id);
Config_Compound *compound = rvalue.compound;
Config_Get_Result_List list = typed_compound_array_reference_list(scratch, parsed, compound);
for (Config_Get_Result_Node *node = list.first; node != 0; node = node->next){
Config_Compound *src = node->result.compound;
String_Const_u8 cmd_string = {0};
String_Const_u8 key_string = {0};
String_Const_u8 mod_string[9] = {0};
if (!config_compound_string_member(parsed, src, "cmd", 0, &cmd_string)){
config_add_error(scratch, parsed, node->result.pos, "Command string is required in binding");
goto finish_map;
}
if (!config_compound_string_member(parsed, src, "key", 1, &key_string)){
config_add_error(scratch, parsed, node->result.pos, "Key string is required in binding");
goto finish_map;
}
for (i32 mod_idx = 0; mod_idx < ArrayCount(mod_string); mod_idx += 1){
String_Const_u8 str = push_stringf(scratch, "mod_%i", mod_idx);
if (config_compound_string_member(parsed, src, str, 2 + mod_idx, &mod_string[mod_idx])){
// NOTE(rjf): No-Op
}
}
// NOTE(rjf): Map read in successfully.
{
// NOTE(rjf): Find command.
Command_Metadata *command = get_command_metadata_from_name(cmd_string);
// NOTE(rjf): Find keycode.
Key_Code keycode = dynamic_binding_key_code_from_string(key_string);
// NOTE(rjf): Find mods.
i32 mod_count = 0;
Key_Code mods[ArrayCount(mod_string)] = {0};
for (i32 i = 0; i < ArrayCount(mod_string); i += 1){
if (mod_string[i].str){
mods[mod_count] = dynamic_binding_key_code_from_string(mod_string[i]);
mod_count += 1;
}
}
if (keycode != 0 && command != 0){
Input_Modifier_Set mods_set = { mods, mod_count, };
map_set_binding(mapping, map, command->proc, InputEventKind_KeyStroke, keycode, &mods_set);
}
else{
config_add_error(scratch, parsed, node->result.pos,
(keycode != 0) ? "Invalid command" :
(command != 0) ? "Invalid key":
"Invalid command and key");
}
}
finish_map:;
}
if (parsed->errors.first != 0){
String_Const_u8 error_text = config_stringize_errors(app, scratch, parsed);
print_message(app, error_text);
}
}
}
}
}
}
return(result);
}
// BOTTOM

View File

@ -31,6 +31,19 @@ get_command_metadata(Custom_Command_Function *func){
return(result); return(result);
} }
function Command_Metadata*
get_command_metadata_from_name(String_Const_u8 name){
Command_Metadata *result = 0;
Command_Metadata *candidate = fcoder_metacmd_table;
for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1, candidate += 1){
if (string_match(SCu8(candidate->name, candidate->name_len), name)){
result = candidate;
break;
}
}
return(result);
}
//////////////////////////////// ////////////////////////////////
function Token_Array function Token_Array

View File

@ -10,9 +10,6 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
SelectMapping(mapping); SelectMapping(mapping);
SelectMap(global_id); SelectMap(global_id);
BindCore(default_startup, CoreCode_Startup);
BindCore(default_try_exit, CoreCode_TryExit);
BindCore(clipboard_record_clip, CoreCode_NewClipboardContents);
Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Command); Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Command);
Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Command, KeyCode_Shift); Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Command, KeyCode_Shift);
Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Control); Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Control);
@ -56,16 +53,8 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
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_Alt); Bind(exit_4coder, KeyCode_F4, KeyCode_Alt);
BindMouseWheel(mouse_wheel_scroll);
BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Command);
SelectMap(file_id); SelectMap(file_id);
ParentMap(global_id);
BindTextInput(write_text_input);
BindMouse(click_set_cursor_and_mark, MouseCode_Left);
BindMouseRelease(click_set_cursor, MouseCode_Left);
BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView);
BindMouseMove(click_set_cursor_if_lbutton);
Bind(delete_char, KeyCode_Delete); Bind(delete_char, KeyCode_Delete);
Bind(backspace_char, KeyCode_Backspace); Bind(backspace_char, KeyCode_Backspace);
Bind(move_up, KeyCode_Up); Bind(move_up, KeyCode_Up);
@ -126,8 +115,6 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
Bind(view_jump_list_with_lister, KeyCode_Period, KeyCode_Command, KeyCode_Shift); Bind(view_jump_list_with_lister, KeyCode_Period, KeyCode_Command, KeyCode_Shift);
SelectMap(code_id); SelectMap(code_id);
ParentMap(file_id);
BindTextInput(write_text_and_auto_indent);
Bind(move_left_alpha_numeric_boundary, KeyCode_Left, KeyCode_Command); Bind(move_left_alpha_numeric_boundary, KeyCode_Left, KeyCode_Command);
Bind(move_right_alpha_numeric_boundary, KeyCode_Right, KeyCode_Command); Bind(move_right_alpha_numeric_boundary, KeyCode_Right, KeyCode_Command);
Bind(move_left_alpha_numeric_or_camel_boundary, KeyCode_Left, KeyCode_Control); Bind(move_left_alpha_numeric_or_camel_boundary, KeyCode_Left, KeyCode_Control);

View File

@ -322,8 +322,8 @@ static Command_Metadata fcoder_metacmd_table[248] = {
{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, { PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 },
{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, { PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 },
{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 844 }, { PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 844 },
{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2248 }, { PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2261 },
{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2256 }, { PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2269 },
{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 525 }, { PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 525 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 542 }, { PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 542 },
{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 348 }, { PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 348 },
@ -452,10 +452,10 @@ static Command_Metadata fcoder_metacmd_table[248] = {
{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1425 }, { PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1425 },
{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1107 }, { PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1107 },
{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1119 }, { PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1119 },
{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2236 }, { PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2249 },
{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2224 }, { PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2237 },
{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2242 }, { PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2255 },
{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2230 }, { PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2243 },
{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 541 }, { PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 541 },
{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 57 }, { PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 57 },
{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "If a scope is selected, find first scope that starts after the selected scope. Otherwise find the first scope that starts after the cursor.", 139, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 66 }, { PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "If a scope is selected, find first scope that starts after the selected scope. Otherwise find the first scope that starts after the cursor.", 139, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 66 },

View File

@ -56,7 +56,4 @@ buffer_lex_task = managed_id_declare(app, string_u8_litexpr("attachment"), strin
buffer_wrap_lines = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_wrap_lines")); buffer_wrap_lines = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_wrap_lines"));
sticky_jump_marker_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("sticky_jump_marker_handle")); sticky_jump_marker_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("sticky_jump_marker_handle"));
attachment_tokens = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("attachment_tokens")); attachment_tokens = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("attachment_tokens"));
mapid_global = managed_id_declare(app, string_u8_litexpr("command_map"), string_u8_litexpr("mapid_global"));
mapid_file = managed_id_declare(app, string_u8_litexpr("command_map"), string_u8_litexpr("mapid_file"));
mapid_code = managed_id_declare(app, string_u8_litexpr("command_map"), string_u8_litexpr("mapid_code"));
} }

140
ship_files/bindings.4coder Normal file
View File

@ -0,0 +1,140 @@
keys_global = {
{ "keyboard_macro_start_recording", "U", "Control" },
{ "keyboard_macro_finish_recording", "U", "Control", "Shift" },
{ "keyboard_macro_replay", "U", "Alt" },
{ "change_active_panel", "Comma", "Control" },
{ "change_active_panel_backwards", "Comma", "Control", "Shift" },
{ "interactive_new", "N", "Control" },
{ "interactive_open_or_new", "O", "Control" },
{ "open_in_other", "O", "Alt" },
{ "interactive_kill_buffer", "K", "Control" },
{ "interactive_switch_buffer", "I", "Control" },
{ "project_go_to_root_directory", "H", "Control" },
{ "save_all_dirty_buffers", "S", "Control", "Shift" },
{ "change_to_build_panel", "Period", "Alt" },
{ "close_build_panel", "Comma", "Alt" },
{ "goto_next_jump", "N", "Alt" },
{ "goto_prev_jump", "N", "Alt", "Shift" },
{ "build_in_build_panel", "M", "Alt" },
{ "goto_first_jump", "M", "Alt", "Shift" },
{ "toggle_filebar", "B", "Alt" },
{ "execute_any_cli", "Z", "Alt" },
{ "execute_previous_cli", "Z", "Alt", "Shift" },
{ "command_lister", "X", "Alt" },
{ "project_command_lister", "X", "Alt", "Shift" },
{ "quick_swap_buffer", "BackwardSlash", "Alt" },
{ "jump_to_last_point", "P", "Control" },
{ "list_all_functions_current_buffer_lister", "I", "Control", "Shift" },
{ "exit_4coder", "F4", "Alt" },
{ "project_fkey_command", "F1" },
{ "project_fkey_command", "F2" },
{ "project_fkey_command", "F3" },
{ "project_fkey_command", "F4" },
{ "project_fkey_command", "F5" },
{ "project_fkey_command", "F6" },
{ "project_fkey_command", "F7" },
{ "project_fkey_command", "F8" },
{ "project_fkey_command", "F9" },
{ "project_fkey_command", "F10" },
{ "project_fkey_command", "F11" },
{ "project_fkey_command", "F12" },
{ "project_fkey_command", "F13" },
{ "project_fkey_command", "F14" },
{ "project_fkey_command", "F15" },
{ "project_fkey_command", "F16" },
};
keys_file = {
{ "delete_char", "Delete" },
{ "backspace_char", "Backspace" },
{ "move_up", "Up" },
{ "move_down", "Down" },
{ "move_left", "Left" },
{ "move_right", "Right" },
{ "seek_end_of_line", "End" },
{ "seek_beginning_of_line", "Home" },
{ "page_up", "PageUp" },
{ "page_down", "PageDown" },
{ "goto_beginning_of_file", "PageUp", "Control" },
{ "goto_end_of_file", "PageDown", "Control" },
{ "move_up_to_blank_line_end", "Up", "Control" },
{ "move_down_to_blank_line_end", "Down", "Control" },
{ "move_left_whitespace_boundary", "Left", "Control" },
{ "move_right_whitespace_boundary", "Right", "Control" },
{ "move_line_up", "Up", "Alt" },
{ "move_line_down", "Down", "Alt" },
{ "backspace_alpha_numeric_boundary", "Backspace", "Control" },
{ "delete_alpha_numeric_boundary", "Delete", "Control" },
{ "snipe_backward_whitespace_or_token_boundary", "Backspace", "Alt" },
{ "snipe_forward_whitespace_or_token_boundary", "Delete", "Alt" },
{ "set_mark", "Space", "Control" },
{ "replace_in_range", "A", "Control" },
{ "copy", "C", "Control" },
{ "delete_range", "D", "Control" },
{ "delete_line", "D", "Control", "Shift" },
{ "center_view", "E", "Control" },
{ "left_adjust_view", "E", "Control", "Shift" },
{ "search", "F", "Control" },
{ "list_all_locations", "F", "Control", "Shift" },
{ "list_all_substring_locations_case_insensitive", "F", "Alt" },
{ "goto_line", "G", "Control" },
{ "list_all_locations_of_selection", "G", "Control", "Shift" },
{ "snippet_lister", "J", "Control" },
{ "kill_buffer", "K", "Control", "Shift" },
{ "duplicate_line", "L", "Control" },
{ "cursor_mark_swap", "M", "Control" },
{ "reopen", "O", "Control", "Shift" },
{ "query_replace", "Q", "Control" },
{ "query_replace_identifier", "Q", "Control", "Shift" },
{ "query_replace_selection", "Q", "Alt" },
{ "reverse_search", "R", "Control" },
{ "save", "S", "Control" },
{ "save_all_dirty_buffers", "S", "Control", "Shift" },
{ "search_identifier", "T", "Control" },
{ "list_all_locations_of_identifier", "T", "Control", "Shift" },
{ "paste_and_indent", "V", "Control" },
{ "paste_next_and_indent", "V", "Control", "Shift" },
{ "cut", "X", "Control" },
{ "redo", "Y", "Control" },
{ "undo", "Z", "Control" },
{ "view_buffer_other_panel", "1", "Control" },
{ "swap_panels", "2", "Control" },
{ "if_read_only_goto_position", "Return" },
{ "if_read_only_goto_position_same_panel", "Return", "Shift" },
{ "view_jump_list_with_lister", "Period", "Control", "Shift" },
};
keys_code = {
{ "move_left_alpha_numeric_boundary", "Left", "Control" },
{ "move_right_alpha_numeric_boundary", "Right", "Control" },
{ "move_left_alpha_numeric_or_camel_boundary", "Left", "Alt" },
{ "move_right_alpha_numeric_or_camel_boundary", "Right", "Alt" },
{ "comment_line_toggle", "Semicolon", "Control" },
{ "word_complete", "Tab" },
{ "auto_indent_range", "Tab", "Control" },
{ "auto_indent_line_at_cursor", "Tab", "Shift" },
{ "word_complete_drop_down", "Tab", "Shift", "Control" },
{ "write_block", "R", "Alt" },
{ "write_todo", "T", "Alt" },
{ "write_note", "Y", "Alt" },
{ "list_all_locations_of_type_definition", "D", "Alt" },
{ "list_all_locations_of_type_definition_of_identifier", "T", "Alt", "Shift" },
{ "open_long_braces", "LeftBracket", "Control" },
{ "open_long_braces_semicolon", "LeftBracket", "Control", "Shift" },
{ "open_long_braces_break", "RightBracket", "Control", "Shift" },
{ "select_surrounding_scope", "LeftBracket", "Alt" },
{ "select_surrounding_scope_maximal", "LeftBracket", "Alt", "Shift" },
{ "select_prev_scope_absolute", "RightBracket", "Alt" },
{ "select_prev_top_most_scope", "RightBracket", "Alt", "Shift" },
{ "select_next_scope_absolute", "Quote", "Alt" },
{ "select_next_scope_after_current", "Quote", "Alt", "Shift" },
{ "place_in_scope", "ForwardSlash", "Alt" },
{ "delete_current_scope", "Minus", "Alt" },
{ "if0_off", "I", "Alt" },
{ "open_file_in_quotes", "1", "Alt" },
{ "open_matching_file_cpp", "2", "Alt" },
{ "write_zero_struct", "0", "Control" },
{ "jump_to_definition_at_cursor", "W", "Control" },
};

View File

@ -0,0 +1,139 @@
keys_global = {
{ "keyboard_macro_start_recording", "U", "Command" },
{ "keyboard_macro_finish_recording", "U", "Command", "Shift" },
{ "keyboard_macro_replay", "U", "Control" },
{ "change_active_panel", "Comma", "Command" },
{ "change_active_panel_backwards", "Comma", "Command", "Shift" },
{ "interactive_new", "N", "Command" },
{ "interactive_open_or_new", "O", "Command" },
{ "open_in_other", "O", "Control" },
{ "interactive_kill_buffer", "K", "Command" },
{ "interactive_switch_buffer", "I", "Command" },
{ "project_go_to_root_directory", "H", "Command" },
{ "save_all_dirty_buffers", "S", "Command", "Shift" },
{ "change_to_build_panel", "Period", "Control" },
{ "close_build_panel", "Comma", "Control" },
{ "goto_next_jump", "N", "Control" },
{ "goto_prev_jump", "N", "Control", "Shift" },
{ "build_in_build_panel", "M", "Control" },
{ "goto_first_jump", "M", "Control", "Shift" },
{ "toggle_filebar", "B", "Control" },
{ "execute_any_cli", "Z", "Control" },
{ "execute_previous_cli", "Z", "Control", "Shift" },
{ "command_lister", "X", "Control" },
{ "project_command_lister", "X", "Control", "Shift" },
{ "quick_swap_buffer", "BackwardSlash", "Control" },
{ "jump_to_last_point", "P", "Command" },
{ "list_all_functions_current_buffer_lister", "I", "Command", "Shift" },
{ "exit_4coder", "F4", "Alt" },
{ "project_fkey_command", "F1" },
{ "project_fkey_command", "F2" },
{ "project_fkey_command", "F3" },
{ "project_fkey_command", "F4" },
{ "project_fkey_command", "F5" },
{ "project_fkey_command", "F6" },
{ "project_fkey_command", "F7" },
{ "project_fkey_command", "F8" },
{ "project_fkey_command", "F9" },
{ "project_fkey_command", "F10" },
{ "project_fkey_command", "F11" },
{ "project_fkey_command", "F12" },
{ "project_fkey_command", "F13" },
{ "project_fkey_command", "F14" },
{ "project_fkey_command", "F15" },
{ "project_fkey_command", "F16" },
};
keys_file = {
{ "delete_char", "Delete" },
{ "backspace_char", "Backspace" },
{ "move_up", "Up" },
{ "move_down", "Down" },
{ "move_left", "Left" },
{ "move_right", "Right" },
{ "seek_end_of_line", "End" },
{ "seek_beginning_of_line", "Home" },
{ "page_up", "PageUp" },
{ "page_down", "PageDown" },
{ "goto_beginning_of_file", "PageUp", "Command" },
{ "goto_end_of_file", "PageDown", "Command" },
{ "move_up_to_blank_line_end", "Up", "Command" },
{ "move_down_to_blank_line_end", "Down", "Command" },
{ "move_left_whitespace_boundary", "Left", "Command" },
{ "move_right_whitespace_boundary", "Right", "Command" },
{ "move_line_up", "Up", "Alt" },
{ "move_line_down", "Down", "Alt" },
{ "backspace_alpha_numeric_boundary", "Backspace", "Command" },
{ "delete_alpha_numeric_boundary", "Delete", "Command" },
{ "snipe_backward_whitespace_or_token_boundary", "Backspace", "Control" },
{ "snipe_forward_whitespace_or_token_boundary", "Delete", "Control" },
{ "set_mark", "Space", "Command" },
{ "replace_in_range", "A", "Command" },
{ "copy", "C", "Command" },
{ "delete_range", "D", "Command" },
{ "delete_line", "D", "Command", "Shift" },
{ "center_view", "E", "Command" },
{ "left_adjust_view", "E", "Command", "Shift" },
{ "search", "F", "Command" },
{ "list_all_locations", "F", "Command", "Shift" },
{ "list_all_substring_locations_case_insensitive", "F", "Control" },
{ "goto_line", "G", "Command" },
{ "list_all_locations_of_selection", "G", "Command", "Shift" },
{ "snippet_lister", "J", "Command" },
{ "kill_buffer", "K", "Command", "Shift" },
{ "duplicate_line", "L", "Command" },
{ "cursor_mark_swap", "M", "Command" },
{ "reopen", "O", "Command", "Shift" },
{ "query_replace", "Q", "Command" },
{ "query_replace_identifier", "Q", "Command", "Shift" },
{ "query_replace_selection", "Q", "Control" },
{ "reverse_search", "R", "Command" },
{ "save", "S", "Command" },
{ "save_all_dirty_buffers", "S", "Command", "Shift" },
{ "search_identifier", "T", "Command" },
{ "list_all_locations_of_identifier", "T", "Command", "Shift" },
{ "paste_and_indent", "V", "Command" },
{ "paste_next_and_indent", "V", "Command", "Shift" },
{ "cut", "X", "Command" },
{ "redo", "Y", "Command" },
{ "undo", "Z", "Command" },
{ "view_buffer_other_panel", "1", "Command" },
{ "swap_panels", "2", "Command" },
{ "if_read_only_goto_position", "Return" },
{ "if_read_only_goto_position_same_panel", "Return", "Shift" },
{ "view_jump_list_with_lister", "Period", "Command", "Shift" },
};
keys_code = {
{ "move_left_alpha_numeric_boundary", "Left", "Command" },
{ "move_right_alpha_numeric_boundary", "Right", "Command" },
{ "move_left_alpha_numeric_or_camel_boundary", "Left", "Control" },
{ "move_right_alpha_numeric_or_camel_boundary", "Right", "Control" },
{ "comment_line_toggle", "Semicolon", "Command" },
{ "word_complete", "Tab" },
{ "auto_indent_range", "Tab", "Command" },
{ "auto_indent_line_at_cursor", "Tab", "Shift" },
{ "word_complete_drop_down", "Tab", "Shift", "Command" },
{ "write_block", "R", "Control" },
{ "write_todo", "T", "Control" },
{ "write_note", "Y", "Control" },
{ "list_all_locations_of_type_definition", "D", "Control" },
{ "list_all_locations_of_type_definition_of_identifier", "T", "Control", "Shift" },
{ "open_long_braces", "LeftBracket", "Command" },
{ "open_long_braces_semicolon", "LeftBracket", "Command", "Shift" },
{ "open_long_braces_break", "RightBracket", "Command", "Shift" },
{ "select_surrounding_scope", "LeftBracket", "Control" },
{ "select_surrounding_scope_maximal", "LeftBracket", "Control", "Shift" },
{ "select_prev_scope_absolute", "RightBracket", "Control" },
{ "select_prev_top_most_scope", "RightBracket", "Control", "Shift" },
{ "select_next_scope_absolute", "Quote", "Control" },
{ "select_next_scope_after_current", "Quote", "Control", "Shift" },
{ "place_in_scope", "ForwardSlash", "Control" },
{ "delete_current_scope", "Minus", "Control" },
{ "if0_off", "I", "Control" },
{ "open_file_in_quotes", "1", "Control" },
{ "open_matching_file_cpp", "2", "Control" },
{ "write_zero_struct", "0", "Command" },
{ "jump_to_definition_at_cursor", "W", "Command" },
};