From c62562095075c9a156e052fb3d283eb7df8d9095 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 17 Sep 2018 11:47:06 -0700 Subject: [PATCH] Setup basics for visible markers, fixed some stability issues --- 4coder_API/types.h | 20 ++- 4coder_combined_write_commands.cpp | 88 +++++++++- 4coder_combined_write_commands.h | 20 +++ 4coder_default_include.cpp | 1 + 4coder_generated/command_metadata.h | 208 +++++++++++----------- 4coder_generated/remapping.h | 14 +- 4coder_helper.cpp | 48 ++++-- 4coder_jump_lister.cpp | 13 +- 4coder_jump_sticky.h | 2 +- 4coder_lists.cpp | 84 ++++----- 4coder_project_commands.cpp | 55 +++++- 4coder_ui_helper.cpp | 37 ++-- 4coder_ui_helper.h | 5 +- 4ed.cpp | 31 ---- 4ed_dynamic_variables.cpp | 3 +- 4ed_edit.cpp | 96 ++++++++--- 4ed_math.h | 257 ++++++++++++++-------------- 4ed_view.cpp | 18 -- 4ed_view_ui.cpp | 2 +- meta/4ed_metagen.cpp | 21 +-- todo.txt | 36 ++-- 21 files changed, 635 insertions(+), 424 deletions(-) create mode 100644 4coder_combined_write_commands.h diff --git a/4coder_API/types.h b/4coder_API/types.h index 1d85ecfc..a51d0c62 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -578,7 +578,7 @@ STRUCT Buffer_Summary{ bool32 ready; /* DOC(If this is not a null summary this field is the id of the associated buffer. If this is a null summary then buffer_id is 0.) */ int32_t buffer_id; - /*DOC(If this is not a null summary, this field contains flags describing the protection status of the buffer.)*/ + /* DOC(If this is not a null summary, this field contains flags describing the protection status of the buffer.) */ Access_Flag lock_flags; /* DOC(If this is not a null summary, this field specifies the number of bytes in the buffer.) */ @@ -609,6 +609,11 @@ STRUCT Buffer_Summary{ bool32 unwrapped_lines; }; +ENUM(int32_t, Marker_Type){ + MarkerType_Standard = 0, + MarkerType_Pair = 1, +}; + /* DOC(A markers is a location in a buffer that, once placed, is effected by edits the same way characters are effected. In particular if an edit occurs in a location in the buffer before a marker, the marker is shifted forward or backward so that it remains on the same character.) DOC_SEE(buffer_add_markers) @@ -620,6 +625,13 @@ STRUCT Marker{ bool32 lean_right; }; +STRUCT Marker_Pair{ + int32_t pos1; + bool32 lean_right1; + int32_t pos2; + bool32 lean_right2; +}; + /* DOC(A four corner axis aligned rectangle, with integer coordinates.) */ @@ -868,10 +880,10 @@ TYPEDEF void Custom_Command_Function(struct Application_Links *app); /* DOC(Generic_Command acts as a name for a command, and can name an internal command or a custom command.) */ UNION Generic_Command{ - /*DOC(If this Generic_Command represents an internal command the cmdid field will have a value less than cmdid_count, and this field is the command id for the command.)*/ + /* DOC(If this Generic_Command represents an internal command the cmdid field will have a value less than cmdid_count, and this field is the command id for the command.) */ Command_ID cmdid; - /*DOC(If this Generic_Command does not represent an internal command the command - field is the pointer to the custom command..)*/ + /* DOC(If this Generic_Command does not represent an internal command the command + field is the pointer to the custom command..) */ Custom_Command_Function *command; }; diff --git a/4coder_combined_write_commands.cpp b/4coder_combined_write_commands.cpp index 502983c4..36a3448c 100644 --- a/4coder_combined_write_commands.cpp +++ b/4coder_combined_write_commands.cpp @@ -1,6 +1,5 @@ /* -4coder_combined_write_commands.cpp - Commands for writing text specialized for particular -contexts. +4coder_combined_write_commands.cpp - Commands for writing text specialized for particular contexts. */ // TOP @@ -115,5 +114,90 @@ CUSTOM_DOC("At the cursor, insert a ' = {0};'.") write_string(app, make_lit_string(" = {0};")); } +//////////////////////////////// + +static Snippet snippets[] = { + // general (for Allen's style) + {"if", "if (){\n\n}\n", 4, 7}, + {"ifelse", "if (){\n\n}\nelse{\n\n}", 4, 7}, + {"forn", "for (;\nnode != 0;\nnode = node->next){\n\n}\n", 5, 38}, + {"fori", "for (i = 0; i < ; i += 1){\n\n}\n", 5, 16}, + {"for", "for (;;){\n\n}\n", 5, 10}, + {"case", "case :\n{\n\n}break;\n", 5, 9}, + {"///", "////////////////////////////////", 32, 32}, + {"#guard", "#if !defined(Z)\n#define Z\n#endif\n", 0, 26}, + {"space", "char space[256];", 0, 14}, + + {"op+", "Z\noperator+(Z a, Z b){\n,\n}\n", 0, 23}, + {"op-", "Z\noperator-(Z a, Z b){\n,\n}\n", 0, 23}, + {"op*", "Z\noperator*(Z a, Z b){\n,\n}\n", 0, 23}, + {"op/", "Z\noperator/(Z a, Z b){\n,\n}\n", 0, 23}, + {"op+=", "Z&\noperator+=(Z &a, Z b){\n,\n}\n", 0, 26}, + {"op-=", "Z&\noperator-=(Z &a, Z b){\n,\n}\n", 0, 26}, + {"op*=", "Z&\noperator*=(Z &a, Z b){\n,\n}\n", 0, 26}, + {"op/=", "Z&\noperator/=(Z &a, Z b){\n,\n}\n", 0, 26}, + + // for 4coder development + {"4command", "CUSTOM_COMMAND_SIG()\nCUSTOM_DOC()\n{\n\n}\n", 19, 32}, + {"4app", "Application_Links *app", 22, 22}, + +#if defined(SNIPPET_EXPANSION) +#include SNIPPET_EXPANSION +#endif +}; + +static void +activate_snippet(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ + int32_t index = (int32_t)PtrAsInt(user_data); + Snippet_Array snippets = *(Snippet_Array*)state->lister.user_data; + if (0 <= index && index < snippets.count){ + Snippet snippet = snippets.snippets[index]; + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); + Buffer_Summary buffer = get_buffer(app, view->buffer_id, AccessOpen); + int32_t pos = view->cursor.pos; + int32_t len = str_size(snippet.text); + buffer_replace_range(app, &buffer, pos, pos, snippet.text, len); + view_set_cursor(app, view, seek_pos(pos + snippet.cursor_offset), true); + view_set_mark(app, view, seek_pos(pos + snippet.mark_offset)); + } + else{ + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); + } + +} + +static void +snippet_lister__parameterized(Application_Links *app, Snippet_Array snippet_array){ + Partition *arena = &global_part; + + View_Summary view = get_active_view(app, AccessAll); + view_end_ui_mode(app, &view); + Temp_Memory temp = begin_temp_memory(arena); + int32_t option_count = snippet_array.count; + Lister_Option *options = push_array(arena, Lister_Option, option_count); + for (int32_t i = 0; i < snippet_array.count; i += 1){ + options[i].string = snippet_array.snippets[i].name; + options[i].status = snippet_array.snippets[i].text; + options[i].user_data = IntAsPtr(i); + } + begin_integrated_lister__basic_list(app, "Snippet:", activate_snippet, + &snippet_array, sizeof(snippet_array), + options, option_count, + 0, + &view); + end_temp_memory(temp); +} + +CUSTOM_COMMAND_SIG(snippet_lister) +CUSTOM_DOC("Opens a snippet lister for inserting whole pre-written snippets of text.") +{ + Snippet_Array snippet_array = {0}; + snippet_array.snippets = snippets; + snippet_array.count = ArrayCount(snippets); + snippet_lister__parameterized(app, snippet_array); +} + // BOTTOM diff --git a/4coder_combined_write_commands.h b/4coder_combined_write_commands.h new file mode 100644 index 00000000..a4ef98e5 --- /dev/null +++ b/4coder_combined_write_commands.h @@ -0,0 +1,20 @@ +/* +4coder_combined_write_commands.cpp - Commands for writing text specialized for particular contexts. +*/ + +// TOP + +struct Snippet{ + char *name; + char *text; + int32_t cursor_offset; + int32_t mark_offset; +}; + +struct Snippet_Array{ + Snippet *snippets; + int32_t count; +}; + +// BOTTOM + diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index af889a45..423e6b14 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -39,6 +39,7 @@ #include "4coder_project_commands.h" #include "4coder_function_list.h" #include "4coder_scope_commands.h" +#include "4coder_combined_write_commands.h" #include "4coder_default_framework_variables.cpp" #include "4coder_buffer_seek_constructors.cpp" diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index c4b2c093..c2a09d88 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 206 +#define command_one_past_last_id 208 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -143,6 +143,7 @@ CUSTOM_COMMAND_SIG(paste_and_indent); CUSTOM_COMMAND_SIG(paste_next); CUSTOM_COMMAND_SIG(paste_next_and_indent); CUSTOM_COMMAND_SIG(place_in_scope); +CUSTOM_COMMAND_SIG(project_command_lister); CUSTOM_COMMAND_SIG(project_fkey_command); CUSTOM_COMMAND_SIG(project_go_to_root_directory); CUSTOM_COMMAND_SIG(query_replace); @@ -193,6 +194,7 @@ CUSTOM_COMMAND_SIG(show_filebar); CUSTOM_COMMAND_SIG(show_scrollbar); CUSTOM_COMMAND_SIG(snipe_token_or_word); CUSTOM_COMMAND_SIG(snipe_token_or_word_right); +CUSTOM_COMMAND_SIG(snippet_lister); CUSTOM_COMMAND_SIG(suppress_mouse); CUSTOM_COMMAND_SIG(swap_buffers_between_panels); CUSTOM_COMMAND_SIG(to_lowercase); @@ -226,7 +228,7 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[206] = { +static Command_Metadata fcoder_metacmd_table[208] = { { PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 240 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 722 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 733 }, @@ -243,10 +245,10 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 374 }, { PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 180 }, { PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 193 }, -{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1048 }, +{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 }, { PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 }, { PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 447 }, -{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 929 }, +{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 935 }, { PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 }, { PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 101 }, { PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 }, @@ -287,14 +289,14 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(highlight_next_scope_absolute, 0), "highlight_next_scope_absolute", 29, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 363 }, { PROC_LINKS(highlight_prev_scope_absolute, 0), "highlight_prev_scope_absolute", 29, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 382 }, { PROC_LINKS(highlight_surrounding_scope, 0), "highlight_surrounding_scope", 27, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 341 }, -{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 82 }, +{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 81 }, { PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 525 }, { PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 503 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 746 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 848 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 875 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 815 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 728 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 749 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 853 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 881 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 819 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 730 }, { PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1450 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 141 }, { PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 358 }, @@ -328,7 +330,7 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 126 }, { PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 193 }, { PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 253 }, -{ PROC_LINKS(load_project, 0), "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\\4coder_project_commands.cpp", 39, 1071 }, +{ PROC_LINKS(load_project, 0), "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\\4coder_project_commands.cpp", 39, 1083 }, { PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1138 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 256 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 268 }, @@ -343,14 +345,14 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 116 }, { PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 562 }, { PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 547 }, -{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1055 }, -{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1062 }, -{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 891 }, +{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 }, +{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 }, +{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 897 }, { PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1357 }, { PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1508 }, -{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 58 }, -{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 74 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 66 }, +{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 57 }, +{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 73 }, +{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 65 }, { PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1393 }, { PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 173 }, { PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 164 }, @@ -361,8 +363,9 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 83 }, { PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 138 }, { PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 481 }, -{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1078 }, -{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1103 }, +{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1529 }, +{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1090 }, +{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1115 }, { PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 918 }, { PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 938 }, { PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 956 }, @@ -403,14 +406,15 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 61 }, { PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 75 }, { PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 92 }, -{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1488 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1500 }, -{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1494 }, -{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1481 }, +{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1500 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1512 }, +{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1506 }, +{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1493 }, { PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 470 }, { PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 456 }, { PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1259 }, { PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1265 }, +{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 193 }, { PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 234 }, { PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1417 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 354 }, @@ -423,16 +427,16 @@ static Command_Metadata fcoder_metacmd_table[206] = { { PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 549 }, { PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1459 }, { PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1407 }, -{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 109 }, +{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 108 }, { PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 856 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 745 }, -{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 106 }, +{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 105 }, { PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 39 }, -{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 94 }, -{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 100 }, -{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 88 }, +{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 93 }, +{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 99 }, +{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 87 }, { PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 48 }, -{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 112 }, +{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 111 }, }; static int32_t fcoder_metacmd_ID_allow_mouse = 0; static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 1; @@ -568,76 +572,78 @@ static int32_t fcoder_metacmd_ID_paste_and_indent = 130; static int32_t fcoder_metacmd_ID_paste_next = 131; static int32_t fcoder_metacmd_ID_paste_next_and_indent = 132; static int32_t fcoder_metacmd_ID_place_in_scope = 133; -static int32_t fcoder_metacmd_ID_project_fkey_command = 134; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 135; -static int32_t fcoder_metacmd_ID_query_replace = 136; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 137; -static int32_t fcoder_metacmd_ID_query_replace_selection = 138; -static int32_t fcoder_metacmd_ID_redo = 139; -static int32_t fcoder_metacmd_ID_reload_themes = 140; -static int32_t fcoder_metacmd_ID_remap_interactive = 141; -static int32_t fcoder_metacmd_ID_rename_file_query = 142; -static int32_t fcoder_metacmd_ID_reopen = 143; -static int32_t fcoder_metacmd_ID_replace_in_range = 144; -static int32_t fcoder_metacmd_ID_reverse_search = 145; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 146; -static int32_t fcoder_metacmd_ID_save = 147; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 148; -static int32_t fcoder_metacmd_ID_save_to_query = 149; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 150; -static int32_t fcoder_metacmd_ID_search = 151; -static int32_t fcoder_metacmd_ID_search_identifier = 152; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 153; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 154; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 155; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 156; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 157; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 158; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 159; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 160; -static int32_t fcoder_metacmd_ID_seek_token_left = 161; -static int32_t fcoder_metacmd_ID_seek_token_right = 162; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 163; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 164; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 165; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 166; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 167; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 168; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 169; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 170; -static int32_t fcoder_metacmd_ID_select_all = 171; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 172; -static int32_t fcoder_metacmd_ID_set_bindings_default = 173; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 174; -static int32_t fcoder_metacmd_ID_set_mark = 175; -static int32_t fcoder_metacmd_ID_setup_build_bat = 176; -static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 177; -static int32_t fcoder_metacmd_ID_setup_build_sh = 178; -static int32_t fcoder_metacmd_ID_setup_new_project = 179; -static int32_t fcoder_metacmd_ID_show_filebar = 180; -static int32_t fcoder_metacmd_ID_show_scrollbar = 181; -static int32_t fcoder_metacmd_ID_snipe_token_or_word = 182; -static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 183; -static int32_t fcoder_metacmd_ID_suppress_mouse = 184; -static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 185; -static int32_t fcoder_metacmd_ID_to_lowercase = 186; -static int32_t fcoder_metacmd_ID_to_uppercase = 187; -static int32_t fcoder_metacmd_ID_toggle_filebar = 188; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 189; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 190; -static int32_t fcoder_metacmd_ID_toggle_mouse = 191; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 192; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 193; -static int32_t fcoder_metacmd_ID_undo = 194; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 195; -static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 196; -static int32_t fcoder_metacmd_ID_word_complete = 197; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 198; -static int32_t fcoder_metacmd_ID_write_block = 199; -static int32_t fcoder_metacmd_ID_write_character = 200; -static int32_t fcoder_metacmd_ID_write_hack = 201; -static int32_t fcoder_metacmd_ID_write_note = 202; -static int32_t fcoder_metacmd_ID_write_todo = 203; -static int32_t fcoder_metacmd_ID_write_underscore = 204; -static int32_t fcoder_metacmd_ID_write_zero_struct = 205; +static int32_t fcoder_metacmd_ID_project_command_lister = 134; +static int32_t fcoder_metacmd_ID_project_fkey_command = 135; +static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 136; +static int32_t fcoder_metacmd_ID_query_replace = 137; +static int32_t fcoder_metacmd_ID_query_replace_identifier = 138; +static int32_t fcoder_metacmd_ID_query_replace_selection = 139; +static int32_t fcoder_metacmd_ID_redo = 140; +static int32_t fcoder_metacmd_ID_reload_themes = 141; +static int32_t fcoder_metacmd_ID_remap_interactive = 142; +static int32_t fcoder_metacmd_ID_rename_file_query = 143; +static int32_t fcoder_metacmd_ID_reopen = 144; +static int32_t fcoder_metacmd_ID_replace_in_range = 145; +static int32_t fcoder_metacmd_ID_reverse_search = 146; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 147; +static int32_t fcoder_metacmd_ID_save = 148; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 149; +static int32_t fcoder_metacmd_ID_save_to_query = 150; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 151; +static int32_t fcoder_metacmd_ID_search = 152; +static int32_t fcoder_metacmd_ID_search_identifier = 153; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 154; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 155; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 156; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 157; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 158; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 159; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 160; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 161; +static int32_t fcoder_metacmd_ID_seek_token_left = 162; +static int32_t fcoder_metacmd_ID_seek_token_right = 163; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 164; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 165; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 166; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 167; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 168; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 169; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 170; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 171; +static int32_t fcoder_metacmd_ID_select_all = 172; +static int32_t fcoder_metacmd_ID_set_bindings_choose = 173; +static int32_t fcoder_metacmd_ID_set_bindings_default = 174; +static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 175; +static int32_t fcoder_metacmd_ID_set_mark = 176; +static int32_t fcoder_metacmd_ID_setup_build_bat = 177; +static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 178; +static int32_t fcoder_metacmd_ID_setup_build_sh = 179; +static int32_t fcoder_metacmd_ID_setup_new_project = 180; +static int32_t fcoder_metacmd_ID_show_filebar = 181; +static int32_t fcoder_metacmd_ID_show_scrollbar = 182; +static int32_t fcoder_metacmd_ID_snipe_token_or_word = 183; +static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 184; +static int32_t fcoder_metacmd_ID_snippet_lister = 185; +static int32_t fcoder_metacmd_ID_suppress_mouse = 186; +static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 187; +static int32_t fcoder_metacmd_ID_to_lowercase = 188; +static int32_t fcoder_metacmd_ID_to_uppercase = 189; +static int32_t fcoder_metacmd_ID_toggle_filebar = 190; +static int32_t fcoder_metacmd_ID_toggle_fullscreen = 191; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 192; +static int32_t fcoder_metacmd_ID_toggle_mouse = 193; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 194; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 195; +static int32_t fcoder_metacmd_ID_undo = 196; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 197; +static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 198; +static int32_t fcoder_metacmd_ID_word_complete = 199; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 200; +static int32_t fcoder_metacmd_ID_write_block = 201; +static int32_t fcoder_metacmd_ID_write_character = 202; +static int32_t fcoder_metacmd_ID_write_hack = 203; +static int32_t fcoder_metacmd_ID_write_note = 204; +static int32_t fcoder_metacmd_ID_write_todo = 205; +static int32_t fcoder_metacmd_ID_write_underscore = 206; +static int32_t fcoder_metacmd_ID_write_zero_struct = 207; #endif diff --git a/4coder_generated/remapping.h b/4coder_generated/remapping.h index 2a46da6d..94281497 100644 --- a/4coder_generated/remapping.h +++ b/4coder_generated/remapping.h @@ -19,7 +19,7 @@ bind(context, 'm', MDFR_ALT, build_in_build_panel); bind(context, 'z', MDFR_ALT, execute_any_cli); bind(context, 'Z', MDFR_ALT, execute_previous_cli); bind(context, 'x', MDFR_ALT, command_lister); -bind(context, 'I', MDFR_CTRL, list_all_functions_all_buffers_lister); +bind(context, 'I', MDFR_CTRL, list_all_functions_current_buffer_lister); bind(context, 'E', MDFR_ALT, exit_4coder); bind(context, key_f1, MDFR_NONE, project_fkey_command); bind(context, key_f2, MDFR_NONE, project_fkey_command); @@ -79,6 +79,7 @@ bind(context, 'F', MDFR_CTRL, list_all_locations); bind(context, 'F', MDFR_ALT, list_all_substring_locations_case_insensitive); bind(context, 'g', MDFR_CTRL, goto_line); bind(context, 'G', MDFR_CTRL, list_all_locations_of_selection); +bind(context, 'j', MDFR_CTRL, snippet_lister); bind(context, 'K', MDFR_CTRL, kill_buffer); bind(context, 'L', MDFR_CTRL, duplicate_line); bind(context, 'm', MDFR_CTRL, cursor_mark_swap); @@ -173,7 +174,7 @@ bind(context, 'm', MDFR_CTRL, build_in_build_panel); bind(context, 'z', MDFR_CTRL, execute_any_cli); bind(context, 'Z', MDFR_CTRL, execute_previous_cli); bind(context, 'x', MDFR_CTRL, command_lister); -bind(context, 'I', MDFR_CMND, list_all_functions_all_buffers_lister); +bind(context, 'I', MDFR_CMND, list_all_functions_current_buffer_lister); bind(context, 'E', MDFR_CTRL, exit_4coder); bind(context, key_f1, MDFR_NONE, project_fkey_command); bind(context, key_f2, MDFR_NONE, project_fkey_command); @@ -359,7 +360,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[36] = { {0, 122, 2, "execute_any_cli", 15, LINK_PROCS(execute_any_cli)}, {0, 90, 2, "execute_previous_cli", 20, LINK_PROCS(execute_previous_cli)}, {0, 120, 2, "command_lister", 14, LINK_PROCS(command_lister)}, -{0, 73, 1, "list_all_functions_all_buffers_lister", 37, LINK_PROCS(list_all_functions_all_buffers_lister)}, +{0, 73, 1, "list_all_functions_current_buffer_lister", 40, LINK_PROCS(list_all_functions_current_buffer_lister)}, {0, 69, 2, "exit_4coder", 11, LINK_PROCS(exit_4coder)}, {0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, @@ -378,7 +379,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[36] = { {0, 55329, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55330, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, }; -static Meta_Key_Bind fcoder_binds_for_default_mapid_file[62] = { +static Meta_Key_Bind fcoder_binds_for_default_mapid_file[63] = { {1, 0, 0, "write_character", 15, LINK_PROCS(write_character)}, {0, 55308, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)}, {0, 55310, 0, "click_set_mark", 14, LINK_PROCS(click_set_mark)}, @@ -419,6 +420,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_file[62] = { {0, 70, 2, "list_all_substring_locations_case_insensitive", 45, LINK_PROCS(list_all_substring_locations_case_insensitive)}, {0, 103, 1, "goto_line", 9, LINK_PROCS(goto_line)}, {0, 71, 1, "list_all_locations_of_selection", 31, LINK_PROCS(list_all_locations_of_selection)}, +{0, 106, 1, "snippet_lister", 14, LINK_PROCS(snippet_lister)}, {0, 75, 1, "kill_buffer", 11, LINK_PROCS(kill_buffer)}, {0, 76, 1, "duplicate_line", 14, LINK_PROCS(duplicate_line)}, {0, 109, 1, "cursor_mark_swap", 16, LINK_PROCS(cursor_mark_swap)}, @@ -493,7 +495,7 @@ static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[14] = { }; static Meta_Sub_Map fcoder_submaps_for_default[4] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 36}, -{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 62}, +{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 63}, {"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_default_default_code_map, 31}, {"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 14}, }; @@ -516,7 +518,7 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[36] = { {0, 122, 1, "execute_any_cli", 15, LINK_PROCS(execute_any_cli)}, {0, 90, 1, "execute_previous_cli", 20, LINK_PROCS(execute_previous_cli)}, {0, 120, 1, "command_lister", 14, LINK_PROCS(command_lister)}, -{0, 73, 4, "list_all_functions_all_buffers_lister", 37, LINK_PROCS(list_all_functions_all_buffers_lister)}, +{0, 73, 4, "list_all_functions_current_buffer_lister", 40, LINK_PROCS(list_all_functions_current_buffer_lister)}, {0, 69, 1, "exit_4coder", 11, LINK_PROCS(exit_4coder)}, {0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, diff --git a/4coder_helper.cpp b/4coder_helper.cpp index e9216217..aa8898b0 100644 --- a/4coder_helper.cpp +++ b/4coder_helper.cpp @@ -31,8 +31,12 @@ begin_bind_helper(void *data, int32_t size){ inline void begin_map(Bind_Helper *helper, int32_t mapid, bool32 replace){ - if (helper->group != 0 && helper->error == 0) helper->error = BH_ERR_MISSING_END; - if (!helper->error && mapid < mapid_global) ++helper->header->header.user_map_count; + if (helper->group != 0 && helper->error == 0){ + helper->error = BH_ERR_MISSING_END; + } + if (!helper->error && mapid < mapid_global){ + ++helper->header->header.user_map_count; + } Binding_Unit unit; unit.type = unit_map_begin; @@ -54,14 +58,20 @@ restart_map(Bind_Helper *helper, int32_t mapid){ inline void end_map(Bind_Helper *helper){ - if (helper->group == 0 && helper->error == 0) helper->error = BH_ERR_MISSING_BEGIN; + if (helper->group == 0 && helper->error == 0){ + helper->error = BH_ERR_MISSING_BEGIN; + } helper->group = 0; } inline void bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Command_ID cmdid){ - if (helper->group == 0 && helper->error == 0) helper->error = BH_ERR_MISSING_BEGIN; - if (!helper->error) ++helper->group->map_begin.bind_count; + if (helper->group == 0 && helper->error == 0){ + helper->error = BH_ERR_MISSING_BEGIN; + } + if (!helper->error){ + ++helper->group->map_begin.bind_count; + } Binding_Unit unit; unit.type = unit_binding; @@ -74,8 +84,12 @@ bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Command_ID cmdid){ inline void bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Custom_Command_Function *func){ - if (helper->group == 0 && helper->error == 0) helper->error = BH_ERR_MISSING_BEGIN; - if (!helper->error) ++helper->group->map_begin.bind_count; + if (helper->group == 0 && helper->error == 0){ + helper->error = BH_ERR_MISSING_BEGIN; + } + if (!helper->error){ + ++helper->group->map_begin.bind_count; + } Binding_Unit unit; unit.type = unit_callback; @@ -1338,27 +1352,27 @@ sort_pairs_by_key__quick(Sort_Pair_i32 *pairs, int32_t first, int32_t one_past_l int32_t dif = one_past_last - first; if (dif >= 2){ int32_t pivot = one_past_last - 1; - int32_t pivot_key = pairs[pivot].key; + Sort_Pair_i32 pivot_pair = pairs[pivot]; int32_t j = first; bool32 interleave = false; for (int32_t i = first; i < pivot; i += 1){ - int32_t key = pairs[i].key; - if (key < pivot_key){ - pairs[i].key = pairs[j].key; - pairs[j].key = key; + Sort_Pair_i32 pair = pairs[i]; + if (pair.key < pivot_pair.key){ + pairs[i] = pairs[j]; + pairs[j] = pair; j += 1; } - else if (key == pivot_key){ + else if (pair.key == pivot_pair.key){ if (interleave){ - pairs[i].key = pairs[j].key; - pairs[j].key = key; + pairs[i] = pairs[j]; + pairs[j] = pair; j += 1; } interleave = !interleave; } } - pairs[pivot].key = pairs[j].key; - pairs[j].key = pivot_key; + pairs[pivot] = pairs[j]; + pairs[j] = pivot_pair; sort_pairs_by_key__quick(pairs, first, j); sort_pairs_by_key__quick(pairs, j + 1, one_past_last); } diff --git a/4coder_jump_lister.cpp b/4coder_jump_lister.cpp index 8643a32f..1d4e6b03 100644 --- a/4coder_jump_lister.cpp +++ b/4coder_jump_lister.cpp @@ -4,15 +4,15 @@ // TOP -static Lister_Activation_Code -activate_jump(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 activated_by_mouse){ +static void +activate_jump(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ + Lister_Activation_Code result_code = ListerActivation_Finished; int32_t list_index = (int32_t)PtrAsInt(user_data); - Lister_State *state = view_get_lister_state(view); Jump_Lister_Parameters *params = (Jump_Lister_Parameters*)state->lister.user_data; Marker_List *list = get_marker_list_for_buffer(params->list_buffer_id); if (list != 0){ - Lister_Activation_Code result_code = ListerActivation_Finished; View_Summary target_view = {0}; switch (params->activation_rule){ case JumpListerActivation_OpenInUIView: @@ -57,9 +57,8 @@ activate_jump(Application_Links *app, View_Summary *view, String text_field, } } - return(result_code); } - return(ListerActivation_Finished); + lister_default(app, scratch, heap, view, state, result_code); } static void diff --git a/4coder_jump_sticky.h b/4coder_jump_sticky.h index b5282975..37f41b48 100644 --- a/4coder_jump_sticky.h +++ b/4coder_jump_sticky.h @@ -24,7 +24,7 @@ struct Sticky_Jump_Stored{ }; struct Sticky_Jump_Array{ - struct Sticky_Jump *jumps; + Sticky_Jump *jumps; int32_t count; }; diff --git a/4coder_lists.cpp b/4coder_lists.cpp index b4a3570a..a4cc8a49 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -624,11 +624,11 @@ enum{ SureToKill_Save = 3, }; -static Lister_Activation_Code -activate_confirm_kill(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ +static void +activate_confirm_kill(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + String text_field, void *user_data, bool32 clicked){ int32_t behavior = (int32_t)PtrAsInt(user_data); - Lister_State *state = view_get_lister_state(view); Buffer_ID buffer_id = *(Buffer_ID*)(state->lister.user_data); switch (behavior){ case SureToKill_No: @@ -655,7 +655,7 @@ activate_confirm_kill(Application_Links *app, View_Summary *view, String text_fi } }break; } - return(ListerActivation_Finished); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); } static void @@ -673,9 +673,10 @@ do_gui_sure_to_kill(Application_Links *app, Buffer_Summary *buffer, View_Summary view); } -static Lister_Activation_Code -activate_confirm_close_4coder(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ +static void +activate_confirm_close_4coder(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + String text_field, void *user_data, bool32 clicked){ int32_t behavior = (int32_t)PtrAsInt(user_data); switch (behavior){ case SureToKill_No: @@ -694,7 +695,7 @@ activate_confirm_close_4coder(Application_Links *app, View_Summary *view, String send_exit_signal(app); }break; } - return(ListerActivation_Finished); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); } static void @@ -715,14 +716,15 @@ do_gui_sure_to_close_4coder(Application_Links *app, View_Summary *view){ //////////////////////////////// -static Lister_Activation_Code -activate_switch_buffer(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 activated_by_mouse){ +static void +activate_switch_buffer(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ if (user_data != 0){ Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(user_data)); view_set_buffer(app, view, buffer_id, SetBuffer_KeepOriginalGUI); } - return(ListerActivation_Finished); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); } CUSTOM_COMMAND_SIG(interactive_switch_buffer) @@ -733,14 +735,15 @@ CUSTOM_DOC("Interactively switch to an open buffer.") begin_integrated_lister__buffer_list(app, "Switch:", activate_switch_buffer, 0, 0, &view); } -static Lister_Activation_Code -activate_kill_buffer(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 activated_by_mouse){ +static void +activate_kill_buffer(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ if (user_data != 0){ Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(user_data)); kill_buffer(app, buffer_identifier(buffer_id), view->view_id, 0); } - return(ListerActivation_Finished); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); } CUSTOM_COMMAND_SIG(interactive_kill_buffer) @@ -790,9 +793,10 @@ activate_open_or_new__generic(Application_Links *app, View_Summary *view, return(result); } -static Lister_Activation_Code -activate_open_or_new(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ +static void +activate_open_or_new(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 clicked){ Lister_Activation_Code result = 0; String file_name = {0}; if (user_data == 0){ @@ -809,7 +813,7 @@ activate_open_or_new(Application_Links *app, View_Summary *view, String text_fie Buffer_Create_Flag flags = 0; result = activate_open_or_new__generic(app, view, file_name, is_folder, flags); } - return(result); + lister_default(app, scratch, heap, view, state, result); } CUSTOM_COMMAND_SIG(interactive_open_or_new) @@ -820,9 +824,10 @@ CUSTOM_DOC("Interactively open a file out of the file system.") begin_integrated_lister__file_system_list(app, "Open:", activate_open_or_new, 0, 0, &view); } -static Lister_Activation_Code -activate_new(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ +static void +activate_new(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 clicked){ Lister_Activation_Code result = 0; String file_name = front_of_directory(text_field); if (user_data != 0){ @@ -842,7 +847,7 @@ activate_new(Application_Links *app, View_Summary *view, String text_field, Buffer_Create_Flag flags = BufferCreate_AlwaysNew; result = activate_open_or_new__generic(app, view, file_name, is_folder, flags); } - return(result); + lister_default(app, scratch, heap, view, state, result); } CUSTOM_COMMAND_SIG(interactive_new) @@ -853,9 +858,10 @@ CUSTOM_DOC("Interactively creates a new file.") begin_integrated_lister__file_system_list(app, "New:", activate_new, 0, 0, &view); } -static Lister_Activation_Code -activate_open(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ +static void +activate_open(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 clicked){ Lister_Activation_Code result = 0; String file_name = {0}; if (user_data != 0){ @@ -869,7 +875,7 @@ activate_open(Application_Links *app, View_Summary *view, String text_field, Buffer_Create_Flag flags = BufferCreate_NeverNew; result = activate_open_or_new__generic(app, view, file_name, is_folder, flags); } - return(result); + lister_default(app, scratch, heap, view, state, result); } CUSTOM_COMMAND_SIG(interactive_open) @@ -880,12 +886,12 @@ CUSTOM_DOC("Interactively opens a file.") begin_integrated_lister__file_system_list(app, "Open:", activate_open, 0, 0, &view); } -static Lister_Activation_Code -activate_select_theme(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 clicked){ - Lister_Activation_Code result = ListerActivation_Finished; +static void +activate_select_theme(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 clicked){ change_theme_by_index(app, (int32_t)PtrAsInt(user_data)); - return(result); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); } CUSTOM_COMMAND_SIG(open_color_tweaker) @@ -915,15 +921,15 @@ CUSTOM_DOC("Opens the 4coder theme selector list.") //////////////////////////////// -static Lister_Activation_Code -activate_command(Application_Links *app, View_Summary *view, String text_field, - void *user_data, bool32 activated_by_mouse){ +static void +activate_command(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); if (user_data != 0){ Custom_Command_Function *command = (Custom_Command_Function*)user_data; - view_end_ui_mode(app, view); command(app); } - return(ListerActivation_Finished); } CUSTOM_COMMAND_SIG(command_lister) diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index 4b580139..dcd87f01 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -1011,6 +1011,18 @@ exec_project_command(Application_Links *app, Project_Command *command){ } } +static void +exec_project_command_by_index(Application_Links *app, int32_t command_index){ + if (!current_project.loaded){ + return; + } + if (command_index < 0 || command_index >= current_project.command_array.count){ + return; + } + Project_Command *command = ¤t_project.command_array.commands[command_index]; + exec_project_command(app, command); +} + static void exec_project_fkey_command(Application_Links *app, int32_t fkey_index){ if (!current_project.loaded){ @@ -1020,8 +1032,8 @@ exec_project_fkey_command(Application_Links *app, int32_t fkey_index){ if (command_index < 0 || command_index >= current_project.command_array.count){ return; } - Project_Command *fkey = ¤t_project.command_array.commands[command_index]; - exec_project_command(app, fkey); + Project_Command *command = ¤t_project.command_array.commands[command_index]; + exec_project_command(app, command); } static void @@ -1503,5 +1515,44 @@ CUSTOM_DOC("Queries the user for several configuration options and initializes a project_setup_scripts__generic(app, &global_part, false, true, true); } +/////////////////////////////// + +static void +activate_project_command(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse){ + int32_t command_index = (int32_t)PtrAsInt(user_data); + exec_project_command_by_index(app, command_index); + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); +} + +CUSTOM_COMMAND_SIG(project_command_lister) +CUSTOM_DOC("Open a lister of all commands in the currently loaded project.") +{ + if (!current_project.loaded){ + return; + } + + Partition *arena = &global_part; + + View_Summary view = get_active_view(app, AccessAll); + view_end_ui_mode(app, &view); + Temp_Memory temp = begin_temp_memory(arena); + int32_t option_count = current_project.command_array.count; + Lister_Option *options = push_array(arena, Lister_Option, option_count); + for (int32_t i = 0; i < current_project.command_array.count; i += 1){ + String string = push_string_copy(arena, current_project.command_array.commands[i].name); + String status = push_string_copy(arena, current_project.command_array.commands[i].cmd); + options[i].string = string.str; + options[i].status = status.str; + options[i].user_data = IntAsPtr(i); + } + begin_integrated_lister__basic_list(app, "Command:", activate_project_command, 0, 0, + options, option_count, + 0, + &view); + end_temp_memory(temp); +} + // BOTTOM diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index a17270b8..f4405d61 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -272,15 +272,21 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, before_extension_matches.node_ptrs = push_array(scratch, Lister_Node*, node_count); Lister_Node_Ptr_Array substring_matches = {0}; substring_matches.node_ptrs = push_array(scratch, Lister_Node*, node_count); + + Absolutes absolutes = {0}; + get_absolutes(state->lister.key_string, &absolutes, true, true); + for (Lister_Node *node = state->lister.options.first; node != 0; node = node->next){ if (state->lister.key_string.size == 0 || - has_substr(node->string, state->lister.key_string)){ + wildcard_match_s(&absolutes, node->string, false)){ + bool32 has_wildcard = (absolutes.count > 2); if (match_insensitive(node->string, state->lister.key_string) && exact_matches.count == 0){ exact_matches.node_ptrs[exact_matches.count++] = node; } - else if (match_part_insensitive(node->string, state->lister.key_string) && + else if (!has_wildcard && + match_part_insensitive(node->string, state->lister.key_string) && node->string.size > state->lister.key_string.size && node->string.str[state->lister.key_string.size] == '.'){ before_extension_matches.node_ptrs[before_extension_matches.count++] = node; @@ -516,14 +522,9 @@ lister_call_refresh_handler(Application_Links *app, Partition *arena, Lister *li } static void -lister_call_activate_handler(Application_Links *app, Partition *scratch, Heap *heap, - View_Summary *view, Lister_State *state, - void *user_data, bool32 activated_by_mouse){ - Lister *lister = &state->lister; - Lister_Activation_Code code = ListerActivation_Finished; - if (lister->handlers.activate != 0){ - code = lister->handlers.activate(app, view, lister->text_field, user_data, activated_by_mouse); - } +lister_default(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + Lister_Activation_Code code){ switch (code){ case ListerActivation_Finished: { @@ -544,12 +545,26 @@ lister_call_activate_handler(Application_Links *app, Partition *scratch, Heap *h { view_start_ui_mode(app, view); state->item_index = 0; - lister_call_refresh_handler(app, &state->arena, lister); + lister_call_refresh_handler(app, &state->arena, &state->lister); lister_update_ui(app, scratch, view, state); }break; } } +static void +lister_call_activate_handler(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, Lister_State *state, + void *user_data, bool32 activated_by_mouse){ + Lister *lister = &state->lister; + if (lister->handlers.activate != 0){ + lister->handlers.activate(app, scratch, heap, view, state, + lister->text_field, user_data, activated_by_mouse); + } + else{ + lister_default(app, scratch, heap, view, state, ListerActivation_Finished); + } +} + static void lister_set_query_string(Lister *lister, char *string){ copy(&lister->query, string); diff --git a/4coder_ui_helper.h b/4coder_ui_helper.h index 94b916ad..a60a0ca2 100644 --- a/4coder_ui_helper.h +++ b/4coder_ui_helper.h @@ -14,8 +14,9 @@ enum{ ListerActivation_ContinueAndRefresh = 2, }; -typedef Lister_Activation_Code Lister_Activation_Function_Type(Application_Links *app, View_Summary *view, - String text_field, void *user_data, bool32 activated_by_mouse); +typedef void Lister_Activation_Function_Type(Application_Links *app, Partition *scratch, Heap *heap, + View_Summary *view, struct Lister_State *state, + String text_field, void *user_data, bool32 activated_by_mouse); typedef void Lister_Regenerate_List_Function_Type(Application_Links *app, Partition *arena, struct Lister *lister); diff --git a/4ed.cpp b/4ed.cpp index 72a6642f..102c404e 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -315,37 +315,6 @@ COMMAND_DECL(save){ } } -internal void -case_change_range(System_Functions *system, Models *models, View *view, Editing_File *file, u8 a, u8 z, u8 char_delta){ - Range range = {0}; - range.min = Min(view->transient.edit_pos->cursor.pos, view->transient.edit_pos->mark); - range.max = Max(view->transient.edit_pos->cursor.pos, view->transient.edit_pos->mark); - if (range.start < range.end){ - Edit_Step step = {}; - step.type = ED_NORMAL; - step.edit.start = range.start; - step.edit.end = range.end; - step.edit.len = range.end - range.start; - - if (file->state.still_lexing){ - system->cancel_job(BACKGROUND_THREADS, file->state.lex_job); - } - - file_update_history_before_edit(&models->mem, file, step, 0, hist_normal); - - u8 *data = (u8*)file->state.buffer.data; - for (i32 i = range.start; i < range.end; ++i){ - if (data[i] >= a && data[i] <= z){ - data[i] += char_delta; - } - } - - if (file->state.token_array.tokens){ - file_relex_parallel(system, models, file, range.start, range.end, 0); - } - } -} - COMMAND_DECL(user_callback){ USE_MODELS(models); if (binding.custom != 0){ diff --git a/4ed_dynamic_variables.cpp b/4ed_dynamic_variables.cpp index 62396c9c..f55d7bf6 100644 --- a/4ed_dynamic_variables.cpp +++ b/4ed_dynamic_variables.cpp @@ -377,7 +377,8 @@ lifetime__free_key(Heap *heap, Lifetime_Allocator *lifetime_allocator, Assert(delete_point_node != 0); Lifetime_Key_Ref_Node *last_node = object->key_node_last; - Lifetime_Key *last_key = last_node->keys[object->key_count % lifetime_key_reference_per_node]; + Lifetime_Key *last_key = last_node->keys[(object->key_count - 1) % ArrayCount(last_node->keys)]; + Assert(last_key != 0); delete_point_node->keys[delete_point_i] = last_key; object->key_count -= 1; diff --git a/4ed_edit.cpp b/4ed_edit.cpp index a36e5809..1b04a3f8 100644 --- a/4ed_edit.cpp +++ b/4ed_edit.cpp @@ -31,16 +31,44 @@ edit_fix_marks__write_workspace_marks(Dynamic_Workspace *workspace, Buffer_ID bu node != 0; node = node->next){ if (node->buffer_id == buffer_id){ - Marker *markers = (Marker*)(node + 1); - Assert(sizeof(Marker) == node->std_header.item_size); - i32 count = node->std_header.count; - for (i32 i = 0; i < count; i += 1){ - if (markers[i].lean_right){ - write_cursor_with_index(r_cursors, r_cursor_count, markers[i].pos); - } - else{ - write_cursor_with_index(cursors , cursor_count , markers[i].pos); - } + Marker_Type marker_type = MarkerType_Standard; + + switch (marker_type){ + case MarkerType_Standard: + { + Marker *markers = (Marker*)(node + 1); + Assert(sizeof(*markers) == node->std_header.item_size); + i32 count = node->std_header.count; + for (i32 i = 0; i < count; i += 1){ + if (markers[i].lean_right){ + write_cursor_with_index(r_cursors, r_cursor_count, markers[i].pos); + } + else{ + write_cursor_with_index(cursors , cursor_count , markers[i].pos); + } + } + }break; + + case MarkerType_Pair: + { + Marker_Pair *markers = (Marker_Pair*)(node + 1); + Assert(sizeof(*markers) == node->std_header.item_size); + i32 count = node->std_header.count; + for (i32 i = 0; i < count; i += 1){ + if (markers[i].lean_right1){ + write_cursor_with_index(r_cursors, r_cursor_count, markers[i].pos1); + } + else{ + write_cursor_with_index(cursors , cursor_count , markers[i].pos1); + } + if (markers[i].lean_right2){ + write_cursor_with_index(r_cursors, r_cursor_count, markers[i].pos2); + } + else{ + write_cursor_with_index(cursors , cursor_count , markers[i].pos2); + } + } + }break; } } } @@ -53,16 +81,44 @@ edit_fix_marks__read_workspace_marks(Dynamic_Workspace *workspace, Buffer_ID buf node != 0; node = node->next){ if (node->buffer_id == buffer_id){ - Marker *markers = (Marker*)(node + 1); - Assert(sizeof(Marker) == node->std_header.item_size); - i32 count = node->std_header.count; - for (i32 i = 0; i < count; i += 1){ - if (markers[i].lean_right){ - markers[i].pos = r_cursors[(*r_cursor_count)++].pos; - } - else{ - markers[i].pos = cursors[(*cursor_count)++].pos; - } + Marker_Type marker_type = MarkerType_Standard; + + switch (marker_type){ + case MarkerType_Standard: + { + Marker *markers = (Marker*)(node + 1); + Assert(sizeof(*markers) == node->std_header.item_size); + i32 count = node->std_header.count; + for (i32 i = 0; i < count; i += 1){ + if (markers[i].lean_right){ + markers[i].pos = r_cursors[(*r_cursor_count)++].pos; + } + else{ + markers[i].pos = cursors[(*cursor_count)++].pos; + } + } + }break; + + case MarkerType_Pair: + { + Marker_Pair *markers = (Marker_Pair*)(node + 1); + Assert(sizeof(*markers) == node->std_header.item_size); + i32 count = node->std_header.count; + for (i32 i = 0; i < count; i += 1){ + if (markers[i].lean_right1){ + markers[i].pos1 = r_cursors[(*r_cursor_count)++].pos; + } + else{ + markers[i].pos1 = cursors[(*cursor_count)++].pos; + } + if (markers[i].lean_right2){ + markers[i].pos2 = r_cursors[(*r_cursor_count)++].pos; + } + else{ + markers[i].pos2 = cursors[(*cursor_count)++].pos; + } + } + }break; } } } diff --git a/4ed_math.h b/4ed_math.h index 44dde5fc..23a45121 100644 --- a/4ed_math.h +++ b/4ed_math.h @@ -26,7 +26,7 @@ ABS(f32 x){ #if C_MATH #include -inline f32 +internal f32 MOD(f32 x, i32 m){ f32 whole; f32 frac = modff(x, &whole); @@ -34,19 +34,19 @@ MOD(f32 x, i32 m){ return(r); } -inline f32 +internal f32 SQRT(f32 x){ f32 r = sqrtf(x); return(r); } -inline f32 +internal f32 SIN(f32 x_degrees){ f32 r = sinf(x_degrees * DEG_TO_RAD); return(r); } -inline f32 +internal f32 COS(f32 x_degrees){ f32 r = cosf(x_degrees * DEG_TO_RAD); return(r); @@ -120,7 +120,7 @@ struct Vec4{ }; }; -inline internal Vec2 +internal Vec2 V2(f32 x, f32 y){ Vec2 result; result.x = x; @@ -128,7 +128,7 @@ V2(f32 x, f32 y){ return result; } -inline internal Vec3 +internal Vec3 V3(f32 x, f32 y, f32 z){ Vec3 result; result.x = x; @@ -137,7 +137,7 @@ V3(f32 x, f32 y, f32 z){ return result; } -inline internal Vec4 +internal Vec4 V4(f32 x, f32 y, f32 z, f32 w){ Vec4 result; result.x = x; @@ -147,190 +147,189 @@ V4(f32 x, f32 y, f32 z, f32 w){ return result; } -inline internal Vec2 +internal Vec2 operator+(Vec2 a, Vec2 b){ Vec2 result; result.x = a.x + b.x; result.y = a.y + b.y; - return result; + return(a + b); } -inline internal Vec3 +internal Vec3 operator+(Vec3 a, Vec3 b){ Vec3 result; result.x = a.x + b.x; result.y = a.y + b.y; result.z = a.z + b.z; - return result; + return(a + b); } -inline internal Vec4 +internal Vec4 operator+(Vec4 a, Vec4 b){ Vec4 result; result.x = a.x + b.x; result.y = a.y + b.y; result.z = a.z + b.z; result.w = a.w + b.w; - return result; + return(a + b); } -inline internal Vec2 +internal Vec2 operator-(Vec2 a, Vec2 b){ Vec2 result; result.x = a.x - b.x; result.y = a.y - b.y; - return result; + return(result); } -inline internal Vec3 +internal Vec3 operator-(Vec3 a, Vec3 b){ Vec3 result; result.x = a.x - b.x; result.y = a.y - b.y; result.z = a.z - b.z; - return result; + return(result); } -inline internal Vec4 +internal Vec4 operator-(Vec4 a, Vec4 b){ Vec4 result; result.x = a.x - b.x; result.y = a.y - b.y; result.z = a.z - b.z; result.w = a.w - b.w; - return result; + return(result); } -inline internal Vec2 +internal Vec2 operator*(Vec2 a, f32 k){ Vec2 result; result.x = a.x * k; result.y = a.y * k; - return result; + return(result); } -inline internal Vec3 +internal Vec3 operator*(Vec3 a, f32 k){ Vec3 result; result.x = a.x * k; result.y = a.y * k; result.z = a.z * k; - return result; + return(result); } -inline internal Vec4 +internal Vec4 operator*(Vec4 a, f32 k){ Vec4 result; result.x = a.x * k; result.y = a.y * k; result.z = a.z * k; result.w = a.w * k; - return result; + return(result); } -inline internal Vec2 +internal Vec2 operator*(f32 k, Vec2 a){ Vec2 result; result.x = a.x * k; result.y = a.y * k; - return result; + return(result); } -inline internal Vec3 +internal Vec3 operator*(f32 k, Vec3 a){ Vec3 result; result.x = a.x * k; result.y = a.y * k; result.z = a.z * k; - return result; + return(result); } -inline internal Vec4 +internal Vec4 operator*(f32 k, Vec4 a){ Vec4 result; result.x = a.x * k; result.y = a.y * k; result.z = a.z * k; result.w = a.w * k; - return result; -} + return(result);} -inline internal Vec2& +internal Vec2& operator+=(Vec2 &a, Vec2 b){ a = (a + b); return a; } -inline internal Vec3& +internal Vec3& operator+=(Vec3 &a, Vec3 b){ a = (a + b); return a; } -inline internal Vec4& +internal Vec4& operator+=(Vec4 &a, Vec4 b){ a = (a + b); return a; } -inline internal Vec2& +internal Vec2& operator-=(Vec2 &a, Vec2 b){ a = (a - b); return a; } -inline internal Vec3& +internal Vec3& operator-=(Vec3 &a, Vec3 b){ a = (a - b); return a; } -inline internal Vec4& +internal Vec4& operator-=(Vec4 &a, Vec4 b){ a = (a - b); return a; } -inline internal Vec2& +internal Vec2& operator*=(Vec2 &a, f32 k){ - a = (a * k); + a = (a*k); return a; } -inline internal Vec3& +internal Vec3& operator*=(Vec3 &a, f32 k){ - a = (a * k); + a = (a*k); return a; } -inline internal Vec4& +internal Vec4& operator*=(Vec4 &a, f32 k){ - a = (a * k); + a = (a*k); return a; } -inline internal f32 +internal f32 dot(Vec2 a, Vec2 b){ f32 result; result = a.x*b.x + a.y*b.y; return result; } -inline internal f32 +internal f32 dot(Vec3 a, Vec3 b){ f32 result; result = a.x*b.x + a.y*b.y + a.z*b.z; return result; } -inline internal f32 +internal f32 dot(Vec4 a, Vec4 b){ f32 result; result = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w; return result; } -inline internal Vec3 +internal Vec3 cross(Vec3 a, Vec3 b){ Vec3 result; result.x = a.y*b.z - b.y*a.z; @@ -339,90 +338,78 @@ cross(Vec3 a, Vec3 b){ return result; } -inline internal Vec2 +internal Vec2 hadamard(Vec2 a, Vec2 b){ - Vec2 result; - result.x = a.x*b.x; - result.y = a.y*b.y; - return result; + a.x *= b.x; + a.y *= b.y; + return(a); } -inline internal Vec3 +internal Vec3 hadamard(Vec3 a, Vec3 b){ - Vec3 result; - result.x = a.x*b.x; - result.y = a.y*b.y; - result.z = a.z*b.z; - return result; + a.x *= b.x; + a.y *= b.y; + a.z *= b.z; + return(a); } -inline internal Vec4 +internal Vec4 hadamard(Vec4 a, Vec4 b){ - Vec4 result; - result.x = a.x*b.x; - result.y = a.y*b.y; - result.z = a.z*b.z; - result.w = a.w*b.w; - return result; + a.x *= b.x; + a.y *= b.y; + a.z *= b.z; + a.w *= b.w; + return(a); } -inline internal Vec2 +internal Vec2 perp(Vec2 v){ - Vec2 result; - result.x = -v.y; - result.y = v.x; - return result; + return(V2(-v.y, v.x)); } -inline Vec2 +internal Vec2 polar_to_cartesian(f32 theta_degrees, f32 length){ - Vec2 result; - result.x = COS(theta_degrees)*length; - result.y = SIN(theta_degrees)*length; - return result; + return(V2(COS(theta_degrees), SIN(theta_degrees))*length); } -inline Vec2 +internal Vec2 rotate(Vec2 v, f32 theta_degrees){ - Vec2 result; - f32 c, s; - c = COS(theta_degrees); - s = SIN(theta_degrees); - result.x = v.x*c - v.y*s; - result.y = v.x*s + v.y*c; - return result; + f32 c = COS(theta_degrees); + f32 s = SIN(theta_degrees); + return(V2(v.x*c - v.y*s, + v.x*s + v.y*c)); } /* - * Lerps, Clamps, Thresholds, Etc +*Lerps, Clamps, Thresholds, Etc */ -inline f32 +internal f32 lerp(f32 a, f32 t, f32 b){ return(a + (b-a)*t); } -inline i32 +internal i32 lerp(i32 a, f32 t, i32 b){ - return ((i32)(lerp((f32)a, t, (f32)b))); + return((i32)(lerp((f32)a, t, (f32)b))); } -inline Vec2 +internal Vec2 lerp(Vec2 a, f32 t, Vec2 b){ return(a + (b-a)*t); } -inline Vec3 +internal Vec3 lerp(Vec3 a, f32 t, Vec3 b){ return(a + (b-a)*t); } -inline Vec4 +internal Vec4 lerp(Vec4 a, f32 t, Vec4 b){ return(a + (b-a)*t); } -inline f32 +internal f32 unlerp(f32 a, f32 x, f32 b){ f32 r = x; if (b > a){ @@ -431,36 +418,48 @@ unlerp(f32 a, f32 x, f32 b){ return(r); } -inline f32 +internal f32 clamp(f32 a, f32 n, f32 z){ - if (n < a) n = a; - else if (n > z) n = z; - return (n); + if (n < a){ + n = a; + } + else if (n > z){ + n = z; + } + return(n); } -inline i32 +internal i32 clamp(i32 a, i32 n, i32 z){ - if (n < a) n = a; - else if (n > z) n = z; - return (n); + if (n < a){ + n = a; + } + else if (n > z){ + n = z; + } + return(n); } -inline u32 +internal u32 clamp(u32 a, u32 n, u32 z){ - if (n < a) n = a; - else if (n > z) n = z; - return (n); + if (n < a){ + n = a; + } + else if (n > z){ + n = z; + } + return(n); } #define clamp_top(a,b) Min(a,b) #define clamp_bottom(a,b) Max(a,b) /* - * Color +*Color */ // TODO(allen): Convert colors to Vec4 -inline u32 +internal u32 color_blend(u32 a, f32 t, u32 b){ union{ u8 byte[4]; @@ -478,7 +477,7 @@ color_blend(u32 a, f32 t, u32 b){ return R.comp; } -inline Vec3 +internal Vec3 unpack_color3(u32 color){ Vec3 result; result.r = ((color >> 16) & 0xFF) / 255.f; @@ -487,7 +486,7 @@ unpack_color3(u32 color){ return result; } -inline Vec4 +internal Vec4 unpack_color4(u32 color){ Vec4 result; result.a = ((color >> 24) & 0xFF) / 255.f; @@ -497,13 +496,13 @@ unpack_color4(u32 color){ return result; } -inline u32 +internal u32 pack_color4(Vec4 color){ u32 result = - ((u8)(color.a * 255) << 24) | - ((u8)(color.r * 255) << 16) | - ((u8)(color.g * 255) << 8) | - ((u8)(color.b * 255) << 0); + ((u8)(color.a*255) << 24) | + ((u8)(color.r*255) << 16) | + ((u8)(color.g*255) << 8) | + ((u8)(color.b*255) << 0); return result; } @@ -531,7 +530,7 @@ rgba_to_hsla(Vec4 rgba){ } delta = max - min; - hsla.z = (max + min) * .5f; + hsla.z = (max + min)*.5f; if (delta == 0){ hsla.x = 0.f; hsla.y = 0.f; @@ -541,7 +540,7 @@ rgba_to_hsla(Vec4 rgba){ case 0: { hsla.x = (rgba.g - rgba.b) / delta; - hsla.x += (rgba.g < rgba.b) * 6.f; + hsla.x += (rgba.g < rgba.b)*6.f; }break; case 1: @@ -556,7 +555,7 @@ rgba_to_hsla(Vec4 rgba){ hsla.x += 4.f; }break; } - hsla.x *= (1/6.f); // * 60 / 360 + hsla.x *= (1/6.f); //*60 / 360 hsla.y = delta / (1.f - ABS(2.f*hsla.z - 1.f)); } @@ -567,10 +566,10 @@ internal Vec4 hsla_to_rgba(Vec4 hsla){ if (hsla.h >= 1.f) hsla.h = 0.f; Vec4 rgba = {0}; - f32 C = (1.f - ABS(2*hsla.z - 1.f)) * hsla.y; - f32 X = C * (1.f-ABS(MOD(hsla.x*6.f, 2)-1.f)); + f32 C = (1.f - ABS(2*hsla.z - 1.f))*hsla.y; + f32 X = C*(1.f-ABS(MOD(hsla.x*6.f, 2)-1.f)); f32 m = hsla.z - C*.5f; - i32 H = floor32(hsla.x * 6.f); + i32 H = floor32(hsla.x*6.f); rgba.a = hsla.a; switch (H){ case 0: rgba.r = C; rgba.g = X; rgba.b = 0; break; @@ -590,7 +589,7 @@ hsla_to_rgba(Vec4 hsla){ // Rectangle Operations // -inline i32_Rect +internal i32_Rect i32R(int32_t l, int32_t t, int32_t r, int32_t b){ i32_Rect rect; rect.x0 = l; rect.y0 = t; @@ -598,7 +597,7 @@ i32R(int32_t l, int32_t t, int32_t r, int32_t b){ return(rect); } -inline i32_Rect +internal i32_Rect i32R(f32_Rect r){ i32_Rect rect; rect.x0 = (int32_t)r.x0; @@ -608,7 +607,7 @@ i32R(f32_Rect r){ return(rect); } -inline f32_Rect +internal f32_Rect f32R(float l, float t, float r, float b){ f32_Rect rect; rect.x0 = l; rect.y0 = t; @@ -616,7 +615,7 @@ f32R(float l, float t, float r, float b){ return(rect); } -inline f32_Rect +internal f32_Rect f32R(i32_Rect r){ f32_Rect rect; rect.x0 = (float)r.x0; @@ -626,23 +625,23 @@ f32R(i32_Rect r){ return(rect); } -inline int32_t +internal int32_t rect_equal(i32_Rect r1, i32_Rect r2){ int32_t result = (r1.x0 == r2.x0 && r1.y0 == r2.y0 && r1.x1 == r2.x1 && r1.y1 == r2.y1); return(result); } -inline int32_t +internal int32_t hit_check(int32_t x, int32_t y, int32_t x0, int32_t y0, int32_t x1, int32_t y1){ return(x >= x0 && x < x1 && y >= y0 && y < y1); } -inline int32_t +internal int32_t hit_check(int32_t x, int32_t y, i32_Rect rect){ return(hit_check(x, y, rect.x0, rect.y0, rect.x1, rect.y1)); } -inline i32_Rect +internal i32_Rect get_inner_rect(i32_Rect outer, i32 margin){ i32_Rect r; r.x0 = outer.x0 + margin; @@ -652,7 +651,7 @@ get_inner_rect(i32_Rect outer, i32 margin){ return(r); } -inline f32_Rect +internal f32_Rect get_inner_rect(f32_Rect outer, f32 margin){ f32_Rect r; r.x0 = outer.x0 + margin; @@ -662,7 +661,7 @@ get_inner_rect(f32_Rect outer, f32 margin){ return(r); } -inline int32_t +internal int32_t fits_inside(i32_Rect rect, i32_Rect outer){ return(rect.x0 >= outer.x0 && rect.x1 <= outer.x1 && rect.y0 >= outer.y0 && rect.y1 <= outer.y1); } diff --git a/4ed_view.cpp b/4ed_view.cpp index ebeacb62..87891d26 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -99,24 +99,6 @@ view_get_cursor_xy(View *view){ return(result); } -#if 0 -internal f32 -view_get_scroll_y(View *view){ - f32 v = 0; - if (!view->transient.ui_mode){ - File_Edit_Positions *edit_pos = view->transient.edit_pos; - TentativeAssert(edit_pos != 0); - if (edit_pos != 0){ - v = edit_pos->scroll.scroll_y; - } - } - else{ - // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): - } - return(v); -} -#endif - inline Cursor_Limits view_cursor_limits(View *view){ Cursor_Limits limits = {0}; diff --git a/4ed_view_ui.cpp b/4ed_view_ui.cpp index d432e836..a92bd8e7 100644 --- a/4ed_view_ui.cpp +++ b/4ed_view_ui.cpp @@ -319,12 +319,12 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc u32 pop_color = style->main.file_info_style.pop2_color; f32_Rect inner = get_inner_rect(item_rect, 3); draw_rectangle(target, inner, back); - draw_margin(target, item_rect, inner, margin_color); i32 x = (i32)inner.x0 + 3; i32 y = (i32)inner.y0 + line_height/2 - 1; x = ceil32(draw_string(system, target, font_id, item->option.string, x, y, text_color)); x += (i32)font_string_width(system, target, font_id, " "); draw_string(system, target, font_id, item->option.status, x, y, pop_color); + draw_margin(target, item_rect, inner, margin_color); }break; case UIType_TextField: diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index ee4ff149..8cf6041a 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -89,9 +89,9 @@ generate_keycode_enum(){ append(&out, "enum{\n"); #define DefKeyEnum(n) append(&out, "key_" #n " = "); append_int_to_str(&out, key_##n); append(&out, ",\n"); - KEY_LIST(DefKeyEnum) + KEY_LIST(DefKeyEnum); #undef DefKeyEnum - append(&out, "};\n"); + append(&out, "};\n"); append(&out, "static char*\n" @@ -100,13 +100,13 @@ generate_keycode_enum(){ "switch(key_code){\n"); #define KeyCase(n) append(&out, "case key_" #n ": result = \"key_" #n "\"; *size = sizeof(\"key_" #n "\")-1; break;\n"); - KEY_LIST(KeyCase) + KEY_LIST(KeyCase); #undef KeyCase - append(&out, - "}\n" - "return(result);\n" - "}\n"); + append(&out, + "}\n" + "return(result);\n" + "}\n"); fm_write_file(filename_keycodes, out.str, out.size); out.size = 0; @@ -119,18 +119,18 @@ internal void struct_begin(String *str, char *name){ append(str, "struct "); append(str, name); - append(str, "{\n"); //} + append(str, "{\n"); } internal void enum_begin(String *str, char *name){ append(str, "enum "); append(str, name); - append(str, "{\n"); //} + append(str, "{\n"); } internal void -struct_end(String *str){ //{ +struct_end(String *str){ append(str, "};\n\n"); } @@ -773,6 +773,7 @@ generate_remapping_code_and_data(){ bind(mappings, 'F', MDFR_ALT , list_all_substring_locations_case_insensitive); bind(mappings, 'g', MDFR_CTRL, goto_line); bind(mappings, 'G', MDFR_CTRL, list_all_locations_of_selection); + bind(mappings, 'j', MDFR_CTRL, snippet_lister); bind(mappings, 'K', MDFR_CTRL, kill_buffer); bind(mappings, 'L', MDFR_CTRL, duplicate_line); bind(mappings, 'm', MDFR_CTRL, cursor_mark_swap); diff --git a/todo.txt b/todo.txt index aeac259b..7a80b75b 100644 --- a/todo.txt +++ b/todo.txt @@ -3,34 +3,16 @@ { Features { - [] fix the thing with thing in the lister thing with lister command things. - [] Cool Listers - { - [x] Command Lister - [x] Convert Jump List to Lister - [x] Function Lister - { - [x] Automatically Make Lister for Function List - [x] Make List For All Buffers - } - [] Snippet Lister - [] Turbo-Word-Complete Lister - [] Project Command Lister - [] Project FKey Remapper - [] Project Mode Lister - } - [] Clip-Box inside UI rects (or at least stop the string before it overflows.) - [] Automatically insert a space after the main name - [] Color Pallette Expansion For Keywords - [] Color Pallette Expansion For Paren/Brace Matching [] Visible Markers { [] Line Highlight [] Cursor Block + [] Cursor Bar [] Wire Cursor Block - [] Cursor Line [] Highlight Range } + [] Color Pallette Expansion For Keywords + [] Color Pallette Expansion For Paren/Brace Matching [] Reload all out of sync files [] Doubly Linked List Node Managed Object } @@ -56,6 +38,9 @@ Long Term { Features { + [] Project FKey Remapper + [] Project Mode Lister + [] Turbo-Word-Complete Lister [] Renderer Modularity [] Software Renderer [] Undo Upgrade @@ -81,7 +66,14 @@ Change Log [x] Separate distinct buffer groups by newline [x] If no results put message explaining that fact (search buffer) [x] Quit UI events - [x] Exact Matches Sort to Top Always ALWAYS ALWAYS ALWAYS + [x] Exact Matches Sort to Top Always ALWAYS ALWAYS ALWAYS[x] Cool Listers + { + [x] Command Lister + [x] Convert Jump List to Lister + [x] Function Lister + [x] Snippet Lister + [x] Project Command Lister + } } }