diff --git a/4coder_auto_indent.cpp b/4coder_auto_indent.cpp index 65827486..ac529bd8 100644 --- a/4coder_auto_indent.cpp +++ b/4coder_auto_indent.cpp @@ -299,13 +299,11 @@ struct Indent_Parse_State{ static int32_t* get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *buffer, Cpp_Token_Array tokens, int32_t line_start, int32_t line_end, bool32 exact_align, int32_t tab_width){ - int32_t indent_mark_count = line_end - line_start; int32_t *indent_marks = push_array(part, int32_t, indent_mark_count); // Shift the array so line_index works correctly. indent_marks -= line_start; - // Decide where to start indentation parsing. Indent_Parse_State indent = {0}; Cpp_Token *token_ptr = find_anchor_token(app, buffer, tokens, line_start, tab_width, &indent.current_indent); @@ -338,7 +336,12 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b --token_ptr; } - for (;line_number < line_end;){ + // LOOP OVER TOKENS + for (;;){ + if (line_number >= line_end){ + break; + } + prev_token = token; ++token_ptr; if (token_ptr < tokens.tokens + tokens.count){ @@ -351,128 +354,123 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b } for (;token.start >= next_line_start_pos && line_number < line_end;){ - next_line_start_pos = buffer_get_line_start(app, buffer, line_number+1); + next_line_start_pos = buffer_get_line_start(app, buffer, line_number + 1); int32_t this_indent = 0; - { - int32_t previous_indent = indent.previous_line_indent; - - int32_t this_line_start = buffer_get_line_start(app, buffer, line_number); - int32_t next_line_start = buffer_get_line_start(app, buffer, line_number+1); - - bool32 did_special_behavior = false; - - if (prev_token.start <= this_line_start && prev_token.start + prev_token.size > this_line_start){ - if (prev_token.type == CPP_TOKEN_COMMENT){ - Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, this_line_start, tab_width); - - if (exact_align){ - this_indent = indent.previous_comment_indent; + int32_t previous_indent = indent.previous_line_indent; + + int32_t this_line_start = buffer_get_line_start(app, buffer, line_number); + int32_t next_line_start = next_line_start_pos; + + bool32 did_multi_line_behavior = false; + + // NOTE(allen): Check for multi-line tokens + if (prev_token.start <= this_line_start && prev_token.start + prev_token.size > this_line_start){ + if (prev_token.type == CPP_TOKEN_COMMENT || prev_token.type == CPP_TOKEN_STRING_CONSTANT){ + Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, this_line_start, tab_width); + + if (exact_align){ + this_indent = indent.previous_comment_indent; + } + else{ + if (hard_start.all_whitespace){ + this_indent = previous_indent; } else{ - if (hard_start.all_whitespace){ - this_indent = previous_indent; - } - else{ - int32_t line_pos = hard_start.char_pos - this_line_start; - this_indent = line_pos + indent.comment_shift; - if (this_indent < 0){ - this_indent = 0; - } + int32_t line_pos = hard_start.char_pos - this_line_start; + this_indent = line_pos + indent.comment_shift; + if (this_indent < 0){ + this_indent = 0; } } - - if (!hard_start.all_whitespace){ - if (line_number >= line_start){ - indent.previous_comment_indent = this_indent; - } - else{ - indent.previous_comment_indent = hard_start.indent_pos; - } + } + + if (!hard_start.all_whitespace){ + if (line_number >= line_start){ + indent.previous_comment_indent = this_indent; + } + else{ + indent.previous_comment_indent = hard_start.indent_pos; } - - did_special_behavior = true; - } - else if (prev_token.type == CPP_TOKEN_STRING_CONSTANT){ - this_indent = previous_indent; - did_special_behavior = true; } + + did_multi_line_behavior = true; } - - if (!did_special_behavior){ - this_indent = indent.current_indent; - if (token.start < next_line_start){ - if (token.flags & CPP_TFLAG_PP_DIRECTIVE){ - this_indent = 0; - } - else{ - switch (token.type){ - case CPP_TOKEN_BRACKET_CLOSE: this_indent -= tab_width; break; - case CPP_TOKEN_BRACE_CLOSE: this_indent -= tab_width; break; - case CPP_TOKEN_BRACE_OPEN: break; + } + + if (!did_multi_line_behavior){ + this_indent = indent.current_indent; + if (token.start < next_line_start){ + if (token.flags & CPP_TFLAG_PP_DIRECTIVE){ + this_indent = 0; + } + else{ + switch (token.type){ + case CPP_TOKEN_BRACKET_CLOSE: this_indent -= tab_width; break; + case CPP_TOKEN_BRACE_CLOSE: this_indent -= tab_width; break; + case CPP_TOKEN_BRACE_OPEN: break; + + default: + if (indent.current_indent > 0){ + bool32 statement_complete = false; - default: - if (indent.current_indent > 0){ - bool32 statement_complete = false; - - Cpp_Token *prev_usable_token_ptr = token_ptr - 1; - Cpp_Token prev_usable_token = {0}; - if (prev_usable_token_ptr >= tokens.tokens){ - prev_usable_token = *prev_usable_token_ptr; - } - - // Scan backwards for the previous token that actually tells us about the statement. - bool32 has_prev_usable_token = true; + Cpp_Token *prev_usable_token_ptr = token_ptr - 1; + Cpp_Token prev_usable_token = {0}; + if (prev_usable_token_ptr >= tokens.tokens){ + prev_usable_token = *prev_usable_token_ptr; + } + + // Scan backwards for the previous token that actually tells us about the statement. + bool32 has_prev_usable_token = true; #define NotUsable(T) \ - (((T).flags&CPP_TFLAG_PP_BODY) || ((T).flags&CPP_TFLAG_PP_DIRECTIVE) || ((T).type == CPP_TOKEN_COMMENT)) - if (NotUsable(prev_usable_token)){ - has_prev_usable_token = false; + (((T).flags&CPP_TFLAG_PP_BODY) || ((T).flags&CPP_TFLAG_PP_DIRECTIVE) || ((T).type == CPP_TOKEN_COMMENT)) + if (NotUsable(prev_usable_token)){ + has_prev_usable_token = false; + + for (--prev_usable_token_ptr; + prev_usable_token_ptr >= tokens.tokens; + --prev_usable_token_ptr){ - for (--prev_usable_token_ptr; - prev_usable_token_ptr >= tokens.tokens; - --prev_usable_token_ptr){ - - prev_usable_token = *prev_usable_token_ptr; - if (!NotUsable(prev_usable_token)){ - has_prev_usable_token = true; - break; - } + prev_usable_token = *prev_usable_token_ptr; + if (!NotUsable(prev_usable_token)){ + has_prev_usable_token = true; + break; } } + } #undef NotUsable - - if (!has_prev_usable_token){ + + if (!has_prev_usable_token){ + statement_complete = true; + } + else{ + if (prev_usable_token.type == CPP_TOKEN_BRACKET_OPEN || + prev_usable_token.type == CPP_TOKEN_BRACE_OPEN || + prev_usable_token.type == CPP_TOKEN_BRACE_CLOSE || + prev_usable_token.type == CPP_TOKEN_SEMICOLON || + prev_usable_token.type == CPP_TOKEN_COLON || + prev_usable_token.type == CPP_TOKEN_COMMA){ statement_complete = true; } - else{ - if (prev_usable_token.type == CPP_TOKEN_BRACKET_OPEN || - prev_usable_token.type == CPP_TOKEN_BRACE_OPEN || - prev_usable_token.type == CPP_TOKEN_BRACE_CLOSE || - prev_usable_token.type == CPP_TOKEN_SEMICOLON || - prev_usable_token.type == CPP_TOKEN_COLON || - prev_usable_token.type == CPP_TOKEN_COMMA){ - statement_complete = true; - } - } - - if (!statement_complete){ - this_indent += tab_width; - } + } + + if (!statement_complete){ + this_indent += tab_width; } } } } - if (this_indent < 0) this_indent = 0; } - - if (indent.paren_nesting > 0){ - if (prev_token.type != CPP_TOKEN_PARENTHESE_OPEN){ - int32_t level = indent.paren_nesting-1; - if (level >= ArrayCount(indent.paren_anchor_indent)){ - level = ArrayCount(indent.paren_anchor_indent)-1; - } - this_indent = indent.paren_anchor_indent[level]; + if (this_indent < 0) this_indent = 0; + } + + if (indent.paren_nesting > 0){ + if (prev_token.type != CPP_TOKEN_PARENTHESE_OPEN){ + int32_t level = indent.paren_nesting-1; + if (level >= ArrayCount(indent.paren_anchor_indent)){ + level = ArrayCount(indent.paren_anchor_indent)-1; } + this_indent = indent.paren_anchor_indent[level]; } } diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 5faacc45..93b3f819 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -895,7 +895,8 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the if (!query_user_string(app, &with)) return; - String r = replace.string, w = with.string; + String r = replace.string; + String w = with.string; uint32_t access = AccessOpen; View_Summary view = get_active_view(app, access); diff --git a/4coder_default_framework.h b/4coder_default_framework.h index 7fa7283c..bc39b926 100644 --- a/4coder_default_framework.h +++ b/4coder_default_framework.h @@ -164,6 +164,7 @@ CUSTOM_DOC("Create a new panel by vertically splitting the active panel.") View_Summary view = get_active_view(app, AccessAll); View_Summary new_view = open_view(app, &view, ViewSplit_Right); new_view_settings(app, &new_view); + view_set_buffer(app, &new_view, view.buffer_id, 0); } CUSTOM_COMMAND_SIG(open_panel_hsplit) @@ -172,6 +173,7 @@ CUSTOM_DOC("Create a new panel by horizontally splitting the active panel.") View_Summary view = get_active_view(app, AccessAll); View_Summary new_view = open_view(app, &view, ViewSplit_Bottom); new_view_settings(app, &new_view); + view_set_buffer(app, &new_view, view.buffer_id, 0); } // diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 80728cf7..f9c4e285 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -185,38 +185,56 @@ CUSTOM_DOC("Delete characters between the cursor position and the first alphanum } CUSTOM_COMMAND_SIG(snipe_token_or_word) -CUSTOM_DOC("Delete a single, whole token on or to the left of the cursor.") +CUSTOM_DOC("Delete a single, whole token on or to the left of the cursor and post it to the clipboard.") { uint32_t access = AccessOpen; View_Summary view = get_active_view(app, access); Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); - int32_t pos1 = buffer_boundary_seek(app, &buffer, view.cursor.pos, false, BoundaryToken | BoundaryWhitespace); - int32_t pos2 = buffer_boundary_seek(app, &buffer, pos1, true, BoundaryToken | BoundaryWhitespace); + int32_t pos1 = buffer_boundary_seek(app, &buffer, view.cursor.pos, false, BoundaryToken|BoundaryWhitespace); + int32_t pos2 = buffer_boundary_seek(app, &buffer, pos1, true, BoundaryToken|BoundaryWhitespace); Range range = make_range(pos1, pos2); + + Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + int32_t len = range.end - range.start; + char *space = push_array(part, char, len); + buffer_read_range(app, &buffer, range.start, range.end, space); + clipboard_post(app, 0, space, len); + end_temp_memory(temp); + buffer_replace_range(app, &buffer, range.start, range.end, 0, 0); } CUSTOM_COMMAND_SIG(snipe_token_or_word_right) -CUSTOM_DOC("Delete a single, whole token on or to the right of the cursor.") +CUSTOM_DOC("Delete a single, whole token on or to the right of the cursor and post it to the clipboard.") { uint32_t access = AccessOpen; View_Summary view = get_active_view(app, access); Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); - int32_t pos2 = buffer_boundary_seek(app, &buffer, view.cursor.pos, true, BoundaryToken | BoundaryWhitespace); - int32_t pos1 = buffer_boundary_seek(app, &buffer, pos2, false, BoundaryToken | BoundaryWhitespace); + int32_t pos2 = buffer_boundary_seek(app, &buffer, view.cursor.pos, true, BoundaryToken|BoundaryWhitespace); + int32_t pos1 = buffer_boundary_seek(app, &buffer, pos2, false, BoundaryToken|BoundaryWhitespace); Range range = make_range(pos1, pos2); + + Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + int32_t len = range.end - range.start; + char *space = push_array(part, char, len); + buffer_read_range(app, &buffer, range.start, range.end, space); + clipboard_post(app, 0, space, len); + end_temp_memory(temp); + buffer_replace_range(app, &buffer, range.start, range.end, 0, 0); } // -// Quer Replace Selection +// Query Replace Selection // CUSTOM_COMMAND_SIG(query_replace_selection) @@ -385,6 +403,81 @@ CUSTOM_DOC("Paste the next item on the clipboard and run auto-indent on the newl } +// +// Approximate Definition Search +// + +static void +get_search_definition(Application_Links *app, Query_Bar *bar, char *string_space, int32_t space_size){ + bar->prompt = make_lit_string("List Definitions For: "); + bar->string = make_string_cap(string_space, 0, space_size); + + if (!query_user_string(app, bar)){ + bar->string.size = 0; + } +} + +static String +build_string(Partition *part, char *s1, char *s2, char *s3){ + String sr = {0}; + sr.memory_size = str_size(s1) + str_size(s2) + str_size(s3); + sr.str = push_array(part, char, sr.memory_size); + append(&sr, s1); + append(&sr, s2); + append(&sr, s3); + return(sr); +} + +static void +list_all_locations_of_type_definition_parameters(Application_Links *app, char *str){ + Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + + String match_strings[6]; + match_strings[0] = build_string(part, "struct ", str, "{"); + match_strings[1] = build_string(part, "struct ", str, "\n{"); + match_strings[2] = build_string(part, "union " , str, "{"); + match_strings[3] = build_string(part, "union " , str, "\n{"); + match_strings[4] = build_string(part, "enum " , str, "{"); + match_strings[5] = build_string(part, "enum " , str, "\n{"); + + list_all_locations_parameters(app, &global_general, part, match_strings, ArrayCount(match_strings), 0); + + end_temp_memory(temp); + + Buffer_Summary buffer = get_buffer_by_name(app, literal("*search*"), AccessAll); + if (buffer.line_count == 2){ + goto_first_jump_same_panel_sticky(app); + } +} + +CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition) +CUSTOM_DOC("Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.") +{ + char string_space[1024]; + Query_Bar bar; + get_search_definition(app, &bar, string_space, sizeof(string_space)); + if (bar.string.size == 0) return; + if (!terminate_with_null(&bar.string)) return; + + list_all_locations_of_type_definition_parameters(app, bar.string.str); +} + +CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier) +CUSTOM_DOC("Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.") +{ + View_Summary view = get_active_view(app, AccessProtected); + Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); + + char space[512]; + String str = get_token_or_word_under_pos(app, &buffer, view.cursor.pos, space, sizeof(space) - 1); + str.str[str.size] = 0; + + change_active_panel(app); + list_all_locations_of_type_definition_parameters(app, str.str); +} + + // // Combined Write Commands // @@ -444,50 +537,7 @@ CUSTOM_DOC("At the cursor, insert a '{' and '}break;' separated by a blank line. CUSTOM_COMMAND_SIG(if0_off) CUSTOM_DOC("Surround the range between the cursor and mark with an '#if 0' and an '#endif'") { - char text1[] = "\n#if 0"; - int32_t size1 = sizeof(text1) - 1; - - char text2[] = "#endif\n"; - int32_t size2 = sizeof(text2) - 1; - - View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - - Range range = get_range(&view); - - if (range.min < range.max){ - Buffer_Edit edits[2]; - char *str = 0; - char *base = (char*)partition_current(&global_part); - - str = push_array(&global_part, char, size1); - memcpy(str, text1, size1); - edits[0].str_start = (int32_t)(str - base); - edits[0].len = size1; - edits[0].start = range.min; - edits[0].end = range.min; - - str = push_array(&global_part, char, size2); - memcpy(str, text2, size2); - edits[1].str_start = (int32_t)(str - base); - edits[1].len = size2; - edits[1].start = range.max; - edits[1].end = range.max; - - buffer_batch_edit(app, &buffer, base, global_part.pos, edits, ArrayCount(edits), BatchEdit_Normal); - - view = get_view(app, view.view_id, AccessAll); - if (view.cursor.pos > view.mark.pos){ - view_set_cursor(app, &view, seek_line_char(view.cursor.line+1, view.cursor.character), 1); - } - else{ - view_set_mark(app, &view, seek_line_char(view.mark.line+1, view.mark.character)); - } - - range = get_range(&view); - buffer_auto_indent(app, &global_part, &buffer, range.min, range.max, DEF_TAB_WIDTH, DEFAULT_INDENT_FLAGS | AutoIndent_FullTokens); - move_past_lead_whitespace(app, &view, &buffer); - } + place_begin_and_end_on_own_lines(app, &global_part, "#if 0", "#endif"); } static void @@ -594,6 +644,10 @@ CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to op } } +// +// File Navigating +// + CUSTOM_COMMAND_SIG(open_in_other) CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to open the corresponding file, displaying it in the other view.") { @@ -601,10 +655,6 @@ CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to op exec_command(app, interactive_open_or_new); } -// -// File Navigating -// - static bool32 get_cpp_matching_file(Application_Links *app, Buffer_Summary buffer, Buffer_Summary *buffer_out){ bool32 result = false; @@ -668,6 +718,30 @@ CUSTOM_DOC("If the current file is a *.cpp or *.h, attempts to open the correspo } } +CUSTOM_COMMAND_SIG(view_buffer_other_panel) +CUSTOM_DOC("Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.") +{ + View_Summary view = get_active_view(app, AccessAll); + int32_t buffer_id = view.buffer_id; + change_active_panel(app); + view = get_active_view(app, AccessAll); + view_set_buffer(app, &view, buffer_id, 0); +} + +CUSTOM_COMMAND_SIG(swap_buffers_between_panels) +CUSTOM_DOC("Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.") +{ + View_Summary view1 = get_active_view(app, AccessAll); + change_active_panel(app); + View_Summary view2 = get_active_view(app, AccessAll); + + if (view1.view_id != view2.view_id){ + int32_t buffer_id1 = view1.buffer_id; + int32_t buffer_id2 = view2.buffer_id; + view_set_buffer(app, &view1, buffer_id2, 0); + view_set_buffer(app, &view2, buffer_id1, 0); + } +} // // Execute Arbitrary Command diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 47ec33ec..8b079c8a 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -1,7 +1,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 185 +#define command_one_past_last_id 192 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -46,6 +46,7 @@ CUSTOM_COMMAND_SIG(execute_arbitrary_command); CUSTOM_COMMAND_SIG(execute_previous_cli); CUSTOM_COMMAND_SIG(exit_4coder); CUSTOM_COMMAND_SIG(goto_first_jump_direct); +CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky); CUSTOM_COMMAND_SIG(goto_first_jump_sticky); CUSTOM_COMMAND_SIG(goto_jump_at_cursor_direct); CUSTOM_COMMAND_SIG(goto_jump_at_cursor_same_panel_direct); @@ -83,6 +84,8 @@ CUSTOM_COMMAND_SIG(list_all_locations_of_identifier); CUSTOM_COMMAND_SIG(list_all_locations_of_identifier_case_insensitive); CUSTOM_COMMAND_SIG(list_all_locations_of_selection); CUSTOM_COMMAND_SIG(list_all_locations_of_selection_case_insensitive); +CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition); +CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier); CUSTOM_COMMAND_SIG(list_all_substring_locations); CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive); CUSTOM_COMMAND_SIG(load_project); @@ -137,6 +140,7 @@ CUSTOM_COMMAND_SIG(remap_interactive); CUSTOM_COMMAND_SIG(rename_file_query); CUSTOM_COMMAND_SIG(rename_parameter); CUSTOM_COMMAND_SIG(reopen); +CUSTOM_COMMAND_SIG(replace_all_occurrences); CUSTOM_COMMAND_SIG(replace_in_range); CUSTOM_COMMAND_SIG(reverse_search); CUSTOM_COMMAND_SIG(reverse_search_identifier); @@ -174,6 +178,7 @@ CUSTOM_COMMAND_SIG(show_scrollbar); CUSTOM_COMMAND_SIG(snipe_token_or_word); CUSTOM_COMMAND_SIG(snipe_token_or_word_right); CUSTOM_COMMAND_SIG(suppress_mouse); +CUSTOM_COMMAND_SIG(swap_buffers_between_panels); CUSTOM_COMMAND_SIG(to_lowercase); CUSTOM_COMMAND_SIG(to_uppercase); CUSTOM_COMMAND_SIG(toggle_filebar); @@ -183,10 +188,12 @@ CUSTOM_COMMAND_SIG(toggle_mouse); CUSTOM_COMMAND_SIG(toggle_show_whitespace); CUSTOM_COMMAND_SIG(toggle_virtual_whitespace); CUSTOM_COMMAND_SIG(undo); +CUSTOM_COMMAND_SIG(view_buffer_other_panel); CUSTOM_COMMAND_SIG(word_complete); CUSTOM_COMMAND_SIG(write_and_auto_tab); CUSTOM_COMMAND_SIG(write_block); CUSTOM_COMMAND_SIG(write_character); +CUSTOM_COMMAND_SIG(write_explicit_enum_flags); CUSTOM_COMMAND_SIG(write_explicit_enum_values); CUSTOM_COMMAND_SIG(write_hack); CUSTOM_COMMAND_SIG(write_note); @@ -204,11 +211,11 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[185] = { -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 230 }, -{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 662 }, -{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 673 }, -{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 652 }, +static Command_Metadata fcoder_metacmd_table[192] = { +{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 232 }, +{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 660 }, +{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 671 }, +{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 650 }, { PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 81 }, { PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 147 }, { PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 514 }, @@ -230,19 +237,20 @@ static Command_Metadata fcoder_metacmd_table[185] = { { PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 615 }, { PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 592 }, { PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 63 }, -{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 474 }, -{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1061 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 351 }, +{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 492 }, +{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1062 }, +{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 369 }, { PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 121 }, { PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 167 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 329 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 347 }, { PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 645 }, { PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 653 }, { PROC_LINKS(execute_any_cli, 0), "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, "C:\\work\\4ed\\code\\4coder_system_command.cpp", 46, 30 }, -{ PROC_LINKS(execute_arbitrary_command, 0), "execute_arbitrary_command", 25, "Execute a 'long form' command.", 30, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 676 }, +{ PROC_LINKS(execute_arbitrary_command, 0), "execute_arbitrary_command", 25, "Execute a 'long form' command.", 30, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 750 }, { PROC_LINKS(execute_previous_cli, 0), "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, "C:\\work\\4ed\\code\\4coder_system_command.cpp", 46, 14 }, { PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 661 }, { PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 100 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 562 }, { PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 544 }, { PROC_LINKS(goto_jump_at_cursor_direct, 0), "goto_jump_at_cursor_direct", 26, "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, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 24 }, { PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list..", 168, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 45 }, @@ -262,28 +270,30 @@ static Command_Metadata fcoder_metacmd_table[185] = { { 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 368 }, { 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 387 }, { 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 346 }, -{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 444 }, +{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 537 }, { PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 603 }, { PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 581 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1200 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1176 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1182 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively opens or creates a new file.", 42, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1188 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1194 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1218 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1201 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1177 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1183 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively opens or creates a new file.", 42, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1189 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1195 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1219 }, { PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 31 }, { 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 151 }, { PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "C:\\work\\4ed\\code\\4coder_function_list.cpp", 45, 348 }, -{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 640 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 658 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 710 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 716 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 758 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 764 }, -{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 649 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 667 }, +{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 698 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 718 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 782 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 788 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 830 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 836 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 454 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 466 }, +{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 708 }, +{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 728 }, { 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 400 }, -{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1129 }, +{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1130 }, { PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 119 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 392 }, { PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 404 }, @@ -292,54 +302,55 @@ static Command_Metadata fcoder_metacmd_table[185] = { { PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 398 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 233 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 245 }, -{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 300 }, +{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 318 }, { PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 286 }, -{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 312 }, -{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 253 }, +{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 330 }, +{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 271 }, { PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 295 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 227 }, { PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 239 }, { PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 122 }, { PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 117 }, { 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, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 132 }, -{ 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 581 }, -{ 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 566 }, +{ 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 600 }, +{ 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 585 }, { 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 165 }, { PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 180 }, -{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1224 }, -{ PROC_LINKS(open_debug, 0), "open_debug", 10, "Opens a debug view for internal use.", 36, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1230 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 584 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file, displaying it in the other view.", 127, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 597 }, -{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 420 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 436 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 428 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 657 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 169 }, +{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1225 }, +{ PROC_LINKS(open_debug, 0), "open_debug", 10, "Opens a debug view for internal use.", 36, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1231 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 634 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file, displaying it in the other view.", 127, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 651 }, +{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 513 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 529 }, +{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 521 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 707 }, +{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 170 }, { PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 161 }, { PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 276 }, { PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 267 }, { PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 70 }, -{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 373 }, +{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 391 }, { 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, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 108 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 380 }, -{ 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 405 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 398 }, +{ 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 486 }, { 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 567 }, { 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 593 }, -{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 982 }, -{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1003 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 222 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1170 }, +{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 983 }, +{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1004 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 240 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1171 }, { PROC_LINKS(reload_current_project, 0), "reload_current_project", 22, "If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 471 }, -{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 741 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1087 }, -{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 343 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1206 }, +{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 743 }, +{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1088 }, +{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 387 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1207 }, +{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 773 }, { PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 880 }, { PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 851 }, { PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 869 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1212 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1026 }, -{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 733 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1213 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1027 }, +{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 751 }, { PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 844 }, { PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 858 }, { PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 128 }, @@ -368,28 +379,31 @@ static Command_Metadata fcoder_metacmd_table[185] = { { 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 650 }, { PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 548 }, { PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 534 }, -{ 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.", 61, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 187 }, -{ 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.", 62, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 202 }, -{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 224 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 187 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 211 }, +{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 226 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 731 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 426 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 406 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 562 }, -{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 242 }, +{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 244 }, { PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 571 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 236 }, +{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 238 }, { PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 638 }, { PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 627 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1164 }, -{ 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, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 786 }, -{ 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, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 685 }, -{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 534 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1165 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 721 }, +{ 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, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 859 }, +{ 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, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 683 }, +{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 584 }, { PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 47 }, -{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 496 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 522 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 528 }, -{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 516 }, +{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 709 }, +{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 703 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 572 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 578 }, +{ 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, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 566 }, { PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 56 }, -{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 540 }, +{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 590 }, }; static int32_t fcoder_metacmd_ID_allow_mouse = 0; static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 1; @@ -429,150 +443,157 @@ static int32_t fcoder_metacmd_ID_execute_arbitrary_command = 34; static int32_t fcoder_metacmd_ID_execute_previous_cli = 35; static int32_t fcoder_metacmd_ID_exit_4coder = 36; static int32_t fcoder_metacmd_ID_goto_first_jump_direct = 37; -static int32_t fcoder_metacmd_ID_goto_first_jump_sticky = 38; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_direct = 39; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel_direct = 40; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel_sticky = 41; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_sticky = 42; -static int32_t fcoder_metacmd_ID_goto_line = 43; -static int32_t fcoder_metacmd_ID_goto_next_jump_direct = 44; -static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips_direct = 45; -static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips_sticky = 46; -static int32_t fcoder_metacmd_ID_goto_next_jump_sticky = 47; -static int32_t fcoder_metacmd_ID_goto_prev_jump_direct = 48; -static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips_direct = 49; -static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips_sticky = 50; -static int32_t fcoder_metacmd_ID_goto_prev_jump_sticky = 51; -static int32_t fcoder_metacmd_ID_hide_filebar = 52; -static int32_t fcoder_metacmd_ID_hide_scrollbar = 53; -static int32_t fcoder_metacmd_ID_highlight_next_scope_absolute = 54; -static int32_t fcoder_metacmd_ID_highlight_prev_scope_absolute = 55; -static int32_t fcoder_metacmd_ID_highlight_surrounding_scope = 56; -static int32_t fcoder_metacmd_ID_if0_off = 57; -static int32_t fcoder_metacmd_ID_increase_face_size = 58; -static int32_t fcoder_metacmd_ID_increase_line_wrap = 59; -static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 60; -static int32_t fcoder_metacmd_ID_interactive_new = 61; -static int32_t fcoder_metacmd_ID_interactive_open = 62; -static int32_t fcoder_metacmd_ID_interactive_open_or_new = 63; -static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 64; -static int32_t fcoder_metacmd_ID_kill_buffer = 65; -static int32_t fcoder_metacmd_ID_kill_rect = 66; -static int32_t fcoder_metacmd_ID_left_adjust_view = 67; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 68; -static int32_t fcoder_metacmd_ID_list_all_locations = 69; -static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 70; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 71; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 72; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 73; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 74; -static int32_t fcoder_metacmd_ID_list_all_substring_locations = 75; -static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 76; -static int32_t fcoder_metacmd_ID_load_project = 77; -static int32_t fcoder_metacmd_ID_make_directory_query = 78; -static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 79; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 80; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 81; -static int32_t fcoder_metacmd_ID_miblo_increment_basic = 82; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 83; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 84; -static int32_t fcoder_metacmd_ID_move_down = 85; -static int32_t fcoder_metacmd_ID_move_down_10 = 86; -static int32_t fcoder_metacmd_ID_move_down_textual = 87; -static int32_t fcoder_metacmd_ID_move_left = 88; -static int32_t fcoder_metacmd_ID_move_line_down = 89; -static int32_t fcoder_metacmd_ID_move_line_up = 90; -static int32_t fcoder_metacmd_ID_move_right = 91; -static int32_t fcoder_metacmd_ID_move_up = 92; -static int32_t fcoder_metacmd_ID_move_up_10 = 93; -static int32_t fcoder_metacmd_ID_multi_line_edit = 94; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 95; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 96; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 97; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 98; -static int32_t fcoder_metacmd_ID_open_all_code = 99; -static int32_t fcoder_metacmd_ID_open_all_code_recursive = 100; -static int32_t fcoder_metacmd_ID_open_color_tweaker = 101; -static int32_t fcoder_metacmd_ID_open_debug = 102; -static int32_t fcoder_metacmd_ID_open_file_in_quotes = 103; -static int32_t fcoder_metacmd_ID_open_in_other = 104; -static int32_t fcoder_metacmd_ID_open_long_braces = 105; -static int32_t fcoder_metacmd_ID_open_long_braces_break = 106; -static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 107; -static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 108; -static int32_t fcoder_metacmd_ID_open_panel_hsplit = 109; -static int32_t fcoder_metacmd_ID_open_panel_vsplit = 110; -static int32_t fcoder_metacmd_ID_page_down = 111; -static int32_t fcoder_metacmd_ID_page_up = 112; -static int32_t fcoder_metacmd_ID_paste = 113; -static int32_t fcoder_metacmd_ID_paste_and_indent = 114; -static int32_t fcoder_metacmd_ID_paste_next = 115; -static int32_t fcoder_metacmd_ID_paste_next_and_indent = 116; -static int32_t fcoder_metacmd_ID_place_in_scope = 117; -static int32_t fcoder_metacmd_ID_project_fkey_command = 118; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 119; -static int32_t fcoder_metacmd_ID_query_replace = 120; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 121; -static int32_t fcoder_metacmd_ID_query_replace_selection = 122; -static int32_t fcoder_metacmd_ID_redo = 123; -static int32_t fcoder_metacmd_ID_reload_current_project = 124; -static int32_t fcoder_metacmd_ID_remap_interactive = 125; -static int32_t fcoder_metacmd_ID_rename_file_query = 126; -static int32_t fcoder_metacmd_ID_rename_parameter = 127; -static int32_t fcoder_metacmd_ID_reopen = 128; -static int32_t fcoder_metacmd_ID_replace_in_range = 129; -static int32_t fcoder_metacmd_ID_reverse_search = 130; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 131; -static int32_t fcoder_metacmd_ID_save = 132; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 133; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 134; -static int32_t fcoder_metacmd_ID_search = 135; -static int32_t fcoder_metacmd_ID_search_identifier = 136; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 137; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 138; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 139; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 140; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 141; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 142; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 143; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 144; -static int32_t fcoder_metacmd_ID_seek_token_left = 145; -static int32_t fcoder_metacmd_ID_seek_token_right = 146; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 147; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 148; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 149; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 150; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 151; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 152; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 153; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 154; -static int32_t fcoder_metacmd_ID_select_all = 155; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 156; -static int32_t fcoder_metacmd_ID_set_bindings_default = 157; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 158; -static int32_t fcoder_metacmd_ID_set_mark = 159; -static int32_t fcoder_metacmd_ID_setup_new_project = 160; -static int32_t fcoder_metacmd_ID_show_filebar = 161; -static int32_t fcoder_metacmd_ID_show_scrollbar = 162; -static int32_t fcoder_metacmd_ID_snipe_token_or_word = 163; -static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 164; -static int32_t fcoder_metacmd_ID_suppress_mouse = 165; -static int32_t fcoder_metacmd_ID_to_lowercase = 166; -static int32_t fcoder_metacmd_ID_to_uppercase = 167; -static int32_t fcoder_metacmd_ID_toggle_filebar = 168; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 169; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 170; -static int32_t fcoder_metacmd_ID_toggle_mouse = 171; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 172; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 173; -static int32_t fcoder_metacmd_ID_undo = 174; -static int32_t fcoder_metacmd_ID_word_complete = 175; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 176; -static int32_t fcoder_metacmd_ID_write_block = 177; -static int32_t fcoder_metacmd_ID_write_character = 178; -static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 179; -static int32_t fcoder_metacmd_ID_write_hack = 180; -static int32_t fcoder_metacmd_ID_write_note = 181; -static int32_t fcoder_metacmd_ID_write_todo = 182; -static int32_t fcoder_metacmd_ID_write_underscore = 183; -static int32_t fcoder_metacmd_ID_write_zero_struct = 184; +static int32_t fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 38; +static int32_t fcoder_metacmd_ID_goto_first_jump_sticky = 39; +static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_direct = 40; +static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel_direct = 41; +static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel_sticky = 42; +static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_sticky = 43; +static int32_t fcoder_metacmd_ID_goto_line = 44; +static int32_t fcoder_metacmd_ID_goto_next_jump_direct = 45; +static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips_direct = 46; +static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips_sticky = 47; +static int32_t fcoder_metacmd_ID_goto_next_jump_sticky = 48; +static int32_t fcoder_metacmd_ID_goto_prev_jump_direct = 49; +static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips_direct = 50; +static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips_sticky = 51; +static int32_t fcoder_metacmd_ID_goto_prev_jump_sticky = 52; +static int32_t fcoder_metacmd_ID_hide_filebar = 53; +static int32_t fcoder_metacmd_ID_hide_scrollbar = 54; +static int32_t fcoder_metacmd_ID_highlight_next_scope_absolute = 55; +static int32_t fcoder_metacmd_ID_highlight_prev_scope_absolute = 56; +static int32_t fcoder_metacmd_ID_highlight_surrounding_scope = 57; +static int32_t fcoder_metacmd_ID_if0_off = 58; +static int32_t fcoder_metacmd_ID_increase_face_size = 59; +static int32_t fcoder_metacmd_ID_increase_line_wrap = 60; +static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 61; +static int32_t fcoder_metacmd_ID_interactive_new = 62; +static int32_t fcoder_metacmd_ID_interactive_open = 63; +static int32_t fcoder_metacmd_ID_interactive_open_or_new = 64; +static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 65; +static int32_t fcoder_metacmd_ID_kill_buffer = 66; +static int32_t fcoder_metacmd_ID_kill_rect = 67; +static int32_t fcoder_metacmd_ID_left_adjust_view = 68; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 69; +static int32_t fcoder_metacmd_ID_list_all_locations = 70; +static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 71; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 72; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 73; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 74; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 75; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 76; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 77; +static int32_t fcoder_metacmd_ID_list_all_substring_locations = 78; +static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 79; +static int32_t fcoder_metacmd_ID_load_project = 80; +static int32_t fcoder_metacmd_ID_make_directory_query = 81; +static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 82; +static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 83; +static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 84; +static int32_t fcoder_metacmd_ID_miblo_increment_basic = 85; +static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 86; +static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 87; +static int32_t fcoder_metacmd_ID_move_down = 88; +static int32_t fcoder_metacmd_ID_move_down_10 = 89; +static int32_t fcoder_metacmd_ID_move_down_textual = 90; +static int32_t fcoder_metacmd_ID_move_left = 91; +static int32_t fcoder_metacmd_ID_move_line_down = 92; +static int32_t fcoder_metacmd_ID_move_line_up = 93; +static int32_t fcoder_metacmd_ID_move_right = 94; +static int32_t fcoder_metacmd_ID_move_up = 95; +static int32_t fcoder_metacmd_ID_move_up_10 = 96; +static int32_t fcoder_metacmd_ID_multi_line_edit = 97; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 98; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 99; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 100; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 101; +static int32_t fcoder_metacmd_ID_open_all_code = 102; +static int32_t fcoder_metacmd_ID_open_all_code_recursive = 103; +static int32_t fcoder_metacmd_ID_open_color_tweaker = 104; +static int32_t fcoder_metacmd_ID_open_debug = 105; +static int32_t fcoder_metacmd_ID_open_file_in_quotes = 106; +static int32_t fcoder_metacmd_ID_open_in_other = 107; +static int32_t fcoder_metacmd_ID_open_long_braces = 108; +static int32_t fcoder_metacmd_ID_open_long_braces_break = 109; +static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 110; +static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 111; +static int32_t fcoder_metacmd_ID_open_panel_hsplit = 112; +static int32_t fcoder_metacmd_ID_open_panel_vsplit = 113; +static int32_t fcoder_metacmd_ID_page_down = 114; +static int32_t fcoder_metacmd_ID_page_up = 115; +static int32_t fcoder_metacmd_ID_paste = 116; +static int32_t fcoder_metacmd_ID_paste_and_indent = 117; +static int32_t fcoder_metacmd_ID_paste_next = 118; +static int32_t fcoder_metacmd_ID_paste_next_and_indent = 119; +static int32_t fcoder_metacmd_ID_place_in_scope = 120; +static int32_t fcoder_metacmd_ID_project_fkey_command = 121; +static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 122; +static int32_t fcoder_metacmd_ID_query_replace = 123; +static int32_t fcoder_metacmd_ID_query_replace_identifier = 124; +static int32_t fcoder_metacmd_ID_query_replace_selection = 125; +static int32_t fcoder_metacmd_ID_redo = 126; +static int32_t fcoder_metacmd_ID_reload_current_project = 127; +static int32_t fcoder_metacmd_ID_remap_interactive = 128; +static int32_t fcoder_metacmd_ID_rename_file_query = 129; +static int32_t fcoder_metacmd_ID_rename_parameter = 130; +static int32_t fcoder_metacmd_ID_reopen = 131; +static int32_t fcoder_metacmd_ID_replace_all_occurrences = 132; +static int32_t fcoder_metacmd_ID_replace_in_range = 133; +static int32_t fcoder_metacmd_ID_reverse_search = 134; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 135; +static int32_t fcoder_metacmd_ID_save = 136; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 137; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 138; +static int32_t fcoder_metacmd_ID_search = 139; +static int32_t fcoder_metacmd_ID_search_identifier = 140; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 141; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 142; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 143; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 144; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 145; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 146; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 147; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 148; +static int32_t fcoder_metacmd_ID_seek_token_left = 149; +static int32_t fcoder_metacmd_ID_seek_token_right = 150; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 151; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 152; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 153; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 154; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 155; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 156; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 157; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 158; +static int32_t fcoder_metacmd_ID_select_all = 159; +static int32_t fcoder_metacmd_ID_set_bindings_choose = 160; +static int32_t fcoder_metacmd_ID_set_bindings_default = 161; +static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 162; +static int32_t fcoder_metacmd_ID_set_mark = 163; +static int32_t fcoder_metacmd_ID_setup_new_project = 164; +static int32_t fcoder_metacmd_ID_show_filebar = 165; +static int32_t fcoder_metacmd_ID_show_scrollbar = 166; +static int32_t fcoder_metacmd_ID_snipe_token_or_word = 167; +static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 168; +static int32_t fcoder_metacmd_ID_suppress_mouse = 169; +static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 170; +static int32_t fcoder_metacmd_ID_to_lowercase = 171; +static int32_t fcoder_metacmd_ID_to_uppercase = 172; +static int32_t fcoder_metacmd_ID_toggle_filebar = 173; +static int32_t fcoder_metacmd_ID_toggle_fullscreen = 174; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 175; +static int32_t fcoder_metacmd_ID_toggle_mouse = 176; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 177; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 178; +static int32_t fcoder_metacmd_ID_undo = 179; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 180; +static int32_t fcoder_metacmd_ID_word_complete = 181; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 182; +static int32_t fcoder_metacmd_ID_write_block = 183; +static int32_t fcoder_metacmd_ID_write_character = 184; +static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 185; +static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 186; +static int32_t fcoder_metacmd_ID_write_hack = 187; +static int32_t fcoder_metacmd_ID_write_note = 188; +static int32_t fcoder_metacmd_ID_write_todo = 189; +static int32_t fcoder_metacmd_ID_write_underscore = 190; +static int32_t fcoder_metacmd_ID_write_zero_struct = 191; diff --git a/4coder_generated/remapping.h b/4coder_generated/remapping.h index eaa75763..190b75cc 100644 --- a/4coder_generated/remapping.h +++ b/4coder_generated/remapping.h @@ -109,8 +109,8 @@ bind(context, 'V', MDFR_CTRL, paste_next_and_indent); bind(context, 'x', MDFR_CTRL, cut); bind(context, 'y', MDFR_CTRL, redo); bind(context, 'z', MDFR_CTRL, undo); -bind(context, '2', MDFR_CTRL, decrease_line_wrap); -bind(context, '3', MDFR_CTRL, increase_line_wrap); +bind(context, '1', MDFR_CTRL, view_buffer_other_panel); +bind(context, '2', MDFR_CTRL, swap_buffers_between_panels); bind(context, '?', MDFR_CTRL, toggle_show_whitespace); bind(context, '~', MDFR_CTRL, clean_all_lines); bind(context, '\n', MDFR_NONE, newline_or_goto_position_sticky); @@ -135,6 +135,8 @@ bind(context, 'h', MDFR_ALT, write_hack); bind(context, 'r', MDFR_ALT, write_block); bind(context, 't', MDFR_ALT, write_todo); bind(context, 'y', MDFR_ALT, write_note); +bind(context, 'D', MDFR_ALT, list_all_locations_of_type_definition); +bind(context, 'T', MDFR_ALT, list_all_locations_of_type_definition_of_identifier); bind(context, '[', MDFR_CTRL, open_long_braces); bind(context, '{', MDFR_CTRL, open_long_braces_semicolon); bind(context, '}', MDFR_CTRL, open_long_braces_break); @@ -259,8 +261,8 @@ bind(context, 'V', MDFR_CMND, paste_next_and_indent); bind(context, 'x', MDFR_CMND, cut); bind(context, 'y', MDFR_CMND, redo); bind(context, 'z', MDFR_CMND, undo); -bind(context, '2', MDFR_CMND, decrease_line_wrap); -bind(context, '3', MDFR_CMND, increase_line_wrap); +bind(context, '1', MDFR_CMND, view_buffer_other_panel); +bind(context, '2', MDFR_CMND, swap_buffers_between_panels); bind(context, '?', MDFR_CMND, toggle_show_whitespace); bind(context, '~', MDFR_CMND, clean_all_lines); bind(context, '\n', MDFR_NONE, newline_or_goto_position_sticky); @@ -285,6 +287,8 @@ bind(context, 'h', MDFR_CTRL, write_hack); bind(context, 'r', MDFR_CTRL, write_block); bind(context, 't', MDFR_CTRL, write_todo); bind(context, 'y', MDFR_CTRL, write_note); +bind(context, 'D', MDFR_CTRL, list_all_locations_of_type_definition); +bind(context, 'T', MDFR_CTRL, list_all_locations_of_type_definition_of_identifier); bind(context, '[', MDFR_CMND, open_long_braces); bind(context, '{', MDFR_CMND, open_long_braces_semicolon); bind(context, '}', MDFR_CMND, open_long_braces_break); @@ -443,15 +447,15 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_file[65] = { {0, 120, 1, "cut", 3, LINK_PROCS(cut)}, {0, 121, 1, "redo", 4, LINK_PROCS(redo)}, {0, 122, 1, "undo", 4, LINK_PROCS(undo)}, -{0, 50, 1, "decrease_line_wrap", 18, LINK_PROCS(decrease_line_wrap)}, -{0, 51, 1, "increase_line_wrap", 18, LINK_PROCS(increase_line_wrap)}, +{0, 49, 1, "view_buffer_other_panel", 23, LINK_PROCS(view_buffer_other_panel)}, +{0, 50, 1, "swap_buffers_between_panels", 27, LINK_PROCS(swap_buffers_between_panels)}, {0, 63, 1, "toggle_show_whitespace", 22, LINK_PROCS(toggle_show_whitespace)}, {0, 126, 1, "clean_all_lines", 15, LINK_PROCS(clean_all_lines)}, {0, 10, 0, "newline_or_goto_position_sticky", 31, LINK_PROCS(newline_or_goto_position_sticky)}, {0, 10, 8, "newline_or_goto_position_same_panel_sticky", 42, LINK_PROCS(newline_or_goto_position_same_panel_sticky)}, {0, 32, 8, "write_character", 15, LINK_PROCS(write_character)}, }; -static Meta_Key_Bind fcoder_binds_for_default_default_code_map[30] = { +static Meta_Key_Bind fcoder_binds_for_default_default_code_map[32] = { {0, 55300, 1, "seek_alphanumeric_or_camel_right", 32, LINK_PROCS(seek_alphanumeric_or_camel_right)}, {0, 55299, 1, "seek_alphanumeric_or_camel_left", 31, LINK_PROCS(seek_alphanumeric_or_camel_left)}, {0, 10, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)}, @@ -468,6 +472,8 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[30] = { {0, 114, 2, "write_block", 11, LINK_PROCS(write_block)}, {0, 116, 2, "write_todo", 10, LINK_PROCS(write_todo)}, {0, 121, 2, "write_note", 10, LINK_PROCS(write_note)}, +{0, 68, 2, "list_all_locations_of_type_definition", 37, LINK_PROCS(list_all_locations_of_type_definition)}, +{0, 84, 2, "list_all_locations_of_type_definition_of_identifier", 51, LINK_PROCS(list_all_locations_of_type_definition_of_identifier)}, {0, 91, 1, "open_long_braces", 16, LINK_PROCS(open_long_braces)}, {0, 123, 1, "open_long_braces_semicolon", 26, LINK_PROCS(open_long_braces_semicolon)}, {0, 125, 1, "open_long_braces_break", 22, LINK_PROCS(open_long_braces_break)}, @@ -486,7 +492,7 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[30] = { static Meta_Sub_Map fcoder_submaps_for_default[3] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 48}, {"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, 65}, -{"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, 30}, +{"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, 32}, }; static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[48] = { {0, 112, 4, "open_panel_vsplit", 17, LINK_PROCS(open_panel_vsplit)}, @@ -595,15 +601,15 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_file[63] = { {0, 120, 4, "cut", 3, LINK_PROCS(cut)}, {0, 121, 4, "redo", 4, LINK_PROCS(redo)}, {0, 122, 4, "undo", 4, LINK_PROCS(undo)}, -{0, 50, 4, "decrease_line_wrap", 18, LINK_PROCS(decrease_line_wrap)}, -{0, 51, 4, "increase_line_wrap", 18, LINK_PROCS(increase_line_wrap)}, +{0, 49, 4, "view_buffer_other_panel", 23, LINK_PROCS(view_buffer_other_panel)}, +{0, 50, 4, "swap_buffers_between_panels", 27, LINK_PROCS(swap_buffers_between_panels)}, {0, 63, 4, "toggle_show_whitespace", 22, LINK_PROCS(toggle_show_whitespace)}, {0, 126, 4, "clean_all_lines", 15, LINK_PROCS(clean_all_lines)}, {0, 10, 0, "newline_or_goto_position_sticky", 31, LINK_PROCS(newline_or_goto_position_sticky)}, {0, 10, 8, "newline_or_goto_position_same_panel_sticky", 42, LINK_PROCS(newline_or_goto_position_same_panel_sticky)}, {0, 32, 8, "write_character", 15, LINK_PROCS(write_character)}, }; -static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[30] = { +static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[32] = { {0, 55300, 4, "seek_alphanumeric_or_camel_right", 32, LINK_PROCS(seek_alphanumeric_or_camel_right)}, {0, 55299, 4, "seek_alphanumeric_or_camel_left", 31, LINK_PROCS(seek_alphanumeric_or_camel_left)}, {0, 10, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)}, @@ -620,6 +626,8 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[30] = { {0, 114, 1, "write_block", 11, LINK_PROCS(write_block)}, {0, 116, 1, "write_todo", 10, LINK_PROCS(write_todo)}, {0, 121, 1, "write_note", 10, LINK_PROCS(write_note)}, +{0, 68, 1, "list_all_locations_of_type_definition", 37, LINK_PROCS(list_all_locations_of_type_definition)}, +{0, 84, 1, "list_all_locations_of_type_definition_of_identifier", 51, LINK_PROCS(list_all_locations_of_type_definition_of_identifier)}, {0, 91, 4, "open_long_braces", 16, LINK_PROCS(open_long_braces)}, {0, 123, 4, "open_long_braces_semicolon", 26, LINK_PROCS(open_long_braces_semicolon)}, {0, 125, 4, "open_long_braces_break", 22, LINK_PROCS(open_long_braces_break)}, @@ -638,7 +646,7 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[30] = { static Meta_Sub_Map fcoder_submaps_for_mac_default[3] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_mac_default_mapid_global, 48}, {"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_mac_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_mac_default_default_code_map, 30}, +{"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_mac_default_default_code_map, 32}, }; static Meta_Mapping fcoder_meta_maps[2] = { {"default", 7, "The default 4coder bindings - typically good for Windows and Linux", 66, fcoder_submaps_for_default, 3, LINK_PROCS(fill_keys_default)}, diff --git a/4coder_helper/4coder_long_seek.h b/4coder_helper/4coder_long_seek.h index c1688bea..8615f06f 100644 --- a/4coder_helper/4coder_long_seek.h +++ b/4coder_helper/4coder_long_seek.h @@ -933,6 +933,36 @@ buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary * } } +typedef uint32_t Buffer_Seek_String_Flags; +enum{ + BufferSeekString_Backward = 1, + BufferSeekString_CaseInsensitive = 2, +}; + +static void +buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, int32_t pos, int32_t end, int32_t min, char *str, int32_t size, int32_t *result, Buffer_Seek_String_Flags flags){ + switch (flags & 3){ + case 0: + { + buffer_seek_string_forward(app, buffer, pos, end, str, size, result); + }break; + + case BufferSeekString_Backward: + { + buffer_seek_string_backward(app, buffer, pos, min, str, size, result); + }break; + + case BufferSeekString_CaseInsensitive: + { + buffer_seek_string_insensitive_forward(app, buffer, pos, end, str, size, result); + }break; + + case BufferSeekString_Backward|BufferSeekString_CaseInsensitive: + { + buffer_seek_string_insensitive_backward(app, buffer, pos, min, str, size, result); + }break; + } +} // // Buffer Line Positioning diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index 7d70c43a..3003de2e 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -559,6 +559,25 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th } } +CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky) +CUSTOM_DOC("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.") +{ + General_Memory *general = &global_general; + Partition *part = &global_part; + + Locked_Jump_State jump_state = get_locked_jump_state(app, part, general); + if (jump_state.view.exists){ + int32_t list_index = 0; + ID_Pos_Jump_Location location = {0}; + if (get_jump_from_list(app, jump_state.list, list_index, &location)){ + Buffer_Summary buffer = {0}; + if (get_jump_buffer(app, &buffer, &location)){ + jump_to_location(app, &jump_state.view, &buffer, location); + } + } + } +} + // // Insert Newline or Tigger Jump on Read Only Buffer // diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index 3d82636e..a2636aa0 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -402,12 +402,10 @@ CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the } } -CUSTOM_COMMAND_SIG(place_in_scope) -CUSTOM_DOC("Wraps the code contained in the range between cursor and mark with a new curly brace scope.") -{ - uint32_t access = AccessOpen; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); +static void +place_begin_and_end_on_own_lines(Application_Links *app, Partition *scratch, char *begin, char *end){ + View_Summary view = get_active_view(app, AccessOpen); + Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); Range lines = {0}; Range range = get_range(&view); @@ -419,22 +417,33 @@ CUSTOM_DOC("Wraps the code contained in the range between cursor and mark with a bool32 do_full = (lines.min < lines.max) || (!buffer_line_is_blank(app, &buffer, lines.min)); + Temp_Memory temp = begin_temp_memory(scratch); + int32_t begin_len = str_size(begin); + int32_t end_len = str_size(end); + + int32_t str_size = begin_len + end_len + 2; + char *str = push_array(scratch, char, str_size); + String builder = make_string_cap(str, 0, str_size); + append(&builder, begin); + append(&builder, "\n"); + append(&builder, "\n"); + append(&builder, end); + if (do_full){ Buffer_Edit edits[2]; - char str[5] = "{\n\n}"; int32_t min_adjustment = 0; int32_t max_adjustment = 4; if (buffer_line_is_blank(app, &buffer, lines.min)){ + memmove(str + 1, str, begin_len); str[0] = '\n'; - str[1] = '{'; ++min_adjustment; } if (buffer_line_is_blank(app, &buffer, lines.max)){ - str[2] = '}'; - str[3] = '\n'; + memmove(str + begin_len + 1, str + begin_len + 2, end_len); + str[begin_len + end_len + 1] = '\n'; --max_adjustment; } @@ -450,25 +459,34 @@ CUSTOM_DOC("Wraps the code contained in the range between cursor and mark with a } edits[0].str_start = 0; - edits[0].len = 2; + edits[0].len = begin_len + 1; edits[0].start = range.min; edits[0].end = range.min; - edits[1].str_start = 2; - edits[1].len = 2; + edits[1].str_start = begin_len + 1; + edits[1].len = end_len + 1; edits[1].start = range.max; edits[1].end = range.max; - buffer_batch_edit(app, &buffer, str, 4, edits, 2, BatchEdit_Normal); + buffer_batch_edit(app, &buffer, str, str_size, edits, 2, BatchEdit_Normal); view_set_cursor(app, &view, seek_pos(cursor_pos), true); view_set_mark(app, &view, seek_pos(mark_pos)); } else{ - buffer_replace_range(app, &buffer, range.min, range.max, "{\n\n}", 4); - view_set_cursor(app, &view, seek_pos(range.min + 2), true); - view_set_mark(app, &view, seek_pos(range.min + 2)); + buffer_replace_range(app, &buffer, range.min, range.max, str, str_size); + int32_t center_pos = range.min + begin_len + 1; + view_set_cursor(app, &view, seek_pos(center_pos), true); + view_set_mark(app, &view, seek_pos(center_pos)); } + + end_temp_memory(temp); +} + +CUSTOM_COMMAND_SIG(place_in_scope) +CUSTOM_DOC("Wraps the code contained in the range between cursor and mark with a new curly brace scope.") +{ + place_begin_and_end_on_own_lines(app, &global_part, "{", "}"); } CUSTOM_COMMAND_SIG(delete_current_scope) diff --git a/4coder_search.cpp b/4coder_search.cpp index f857e34d..c544171d 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -10,6 +10,8 @@ TYPE: 'drop-in-command-pack' #if !defined(FCODER_SEARCH) #define FCODER_SEARCH +#include "4coder_search.h" + #include "4coder_lib/4coder_table.h" #include "4coder_lib/4coder_mem.h" @@ -22,62 +24,47 @@ TYPE: 'drop-in-command-pack' // Search Iteration Systems // -enum Search_Range_Type{ - SearchRange_FrontToBack, - SearchRange_BackToFront, - SearchRange_Wave, -}; - -enum Search_Range_Flag{ - SearchFlag_MatchWholeWord = 0x00, - SearchFlag_MatchWordPrefix = 0x01, - SearchFlag_MatchSubstring = 0x02, - SearchFlag_MatchMask = 0xFF, - SearchFlag_CaseInsensitive = 0x0100, -}; - -struct Search_Range{ - int32_t type; - uint32_t flags; - int32_t buffer; - int32_t start; - int32_t size; - int32_t mid_start; - int32_t mid_size; -}; - -struct Search_Set{ - Search_Range *ranges; - int32_t count; - int32_t max; -}; - -struct Search_Iter{ - String word; - int32_t pos; - int32_t back_pos; - int32_t i; - int32_t range_initialized; -}; - -struct Search_Match{ - Buffer_Summary buffer; - int32_t start; - int32_t end; - int32_t found_match; -}; +static void +search_key_alloc(General_Memory *general, Search_Key *key, int32_t *size, int32_t count){ + if (count > ArrayCount(key->words)){ + count = ArrayCount(key->words); + } + + int32_t min_size = 0x7FFFFFFF; + int32_t total_size = 0; + for (int32_t i = 0; i < count; ++i){ + total_size += size[i]; + if (min_size > size[i]){ + min_size = size[i]; + } + } + + int32_t max_base_size = total_size*2; + + if (key->base == 0){ + key->base = (char*)general_memory_allocate(general, max_base_size); + key->base_size = max_base_size; + } + else if (key->base_size < total_size){ + key->base = (char*)general_memory_reallocate_nocopy(general, key->base, max_base_size); + key->base_size = max_base_size; + } + + char *char_ptr = key->base; + for (int32_t i = 0; i < count; ++i){ + key->words[i].str = char_ptr; + key->words[i].size = 0; + key->words[i].memory_size = size[i]; + char_ptr += size[i]; + } + + key->count = count; + key->min_size = min_size; +} static void -search_iter_init(General_Memory *general, Search_Iter *iter, int32_t size){ - int32_t str_max = size*2; - if (iter->word.str == 0){ - iter->word.str = (char*)general_memory_allocate(general, str_max); - iter->word.memory_size = str_max; - } - else if (iter->word.memory_size < size){ - iter->word.str = (char*)general_memory_reallocate_nocopy(general, iter->word.str, str_max); - iter->word.memory_size = str_max; - } +search_iter_init(Search_Iter *iter, Search_Key key){ + iter->key = key; iter->i = 0; iter->range_initialized = 0; } @@ -136,6 +123,10 @@ search_hits_init(General_Memory *general, Table *hits, String_Space *str, int32_ table_clear(hits); } +// +// Table Operations +// + static int32_t search_hit_add(General_Memory *general, Table *hits, String_Space *space, char *str, int32_t len){ int32_t result = false; @@ -174,6 +165,53 @@ search_hit_add(General_Memory *general, Table *hits, String_Space *space, char * return(result); } +// +// Search Key Checking +// + +typedef uint32_t Seek_Potential_Match_Direction; +enum{ + SeekPotentialMatch_Forward, + SeekPotentialMatch_Backward, +}; + +static void +seek_potential_match(Application_Links *app, Search_Range *range, Search_Key key, Search_Match *result, Seek_Potential_Match_Direction direction, int32_t start_pos, int32_t end_pos){ + bool32 case_insensitive = ((range->flags & SearchFlag_CaseInsensitive) != 0); + bool32 forward = (direction == SeekPotentialMatch_Forward); +#define OptFlag(b,f) ((b)?(f):(0)) + Buffer_Seek_String_Flags flags = 0 + | OptFlag(case_insensitive, BufferSeekString_CaseInsensitive) + | OptFlag(!forward, BufferSeekString_Backward); + result->buffer = get_buffer(app, range->buffer, AccessAll); + + int32_t best_pos = 0; + if (forward){ + best_pos = end_pos; + } + + for (int32_t i = 0; i < key.count; ++i){ + String word = key.words[i]; + int32_t new_pos = -1; + buffer_seek_string(app, &result->buffer, start_pos, end_pos, range->start, word.str, word.size, &new_pos, flags); + + if (new_pos >= 0){ + if (forward){ + if (new_pos < best_pos){ + best_pos = new_pos; + } + } + else{ + if (new_pos > best_pos){ + best_pos = new_pos; + } + } + } + } + + result->start = best_pos; +} + static int32_t buffer_seek_alpha_numeric_end(Application_Links *app, Buffer_Summary *buffer, int32_t pos){ char space[1024]; @@ -192,68 +230,73 @@ buffer_seek_alpha_numeric_end(Application_Links *app, Buffer_Summary *buffer, in return(pos); } -static void -search_iter_next_range(Search_Iter *it){ - ++it->i; - it->pos = 0; - it->back_pos = 0; - it->range_initialized = 0; -} - enum{ FindResult_None, FindResult_FoundMatch, - FindResult_PastEnd + FindResult_PastEnd, }; static int32_t -match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Match *result_ptr, String word){ - int32_t found_match = FindResult_None; +match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Match *result_ptr, Search_Key key){ + int32_t result_code = FindResult_None; Search_Match result = *result_ptr; int32_t end_pos = range->start + range->size; int32_t type = (range->flags & SearchFlag_MatchMask); + result.match_word_index = -1; - switch (type){ - case SearchFlag_MatchWholeWord: - { - char first = word.str[0]; - - char prev = ' '; - if (char_is_alpha_numeric_utf8(first)){ - prev = buffer_get_char(app, &result.buffer, result.start - 1); - } - - if (!char_is_alpha_numeric_utf8(prev)){ - result.end = result.start + word.size; - if (result.end <= end_pos){ - char last = word.str[word.size-1]; - - char next = ' '; - if (char_is_alpha_numeric_utf8(last)){ - next = buffer_get_char(app, &result.buffer, result.end); + for (int32_t i = 0; i < key.count; ++i){ + String word = key.words[i]; + + int32_t found_match = FindResult_None; + switch (type){ + case SearchFlag_MatchWholeWord: + { + char prev = ' '; + if (char_is_alpha_numeric_utf8(word.str[0])){ + prev = buffer_get_char(app, &result.buffer, result.start - 1); + } + + if (!char_is_alpha_numeric_utf8(prev)){ + result.end = result.start + word.size; + if (result.end <= end_pos){ + char next = ' '; + if (char_is_alpha_numeric_utf8(word.str[word.size-1])){ + next = buffer_get_char(app, &result.buffer, result.end); + } + + if (!char_is_alpha_numeric_utf8(next)){ + result.found_match = true; + found_match = FindResult_FoundMatch; + } } + else{ + found_match = FindResult_PastEnd; + } + } + }break; + + case SearchFlag_MatchWordPrefix: + { + char prev = buffer_get_char(app, &result.buffer, result.start - 1); + if (!char_is_alpha_numeric_utf8(prev)){ + result.end = + buffer_seek_alpha_numeric_end(app, &result.buffer, result.start); - if (!char_is_alpha_numeric_utf8(next)){ + if (result.end <= end_pos){ result.found_match = true; found_match = FindResult_FoundMatch; } + else{ + found_match = FindResult_PastEnd; + } } - else{ - found_match = FindResult_PastEnd; - } - } - }break; - - case SearchFlag_MatchWordPrefix: - { - char prev = buffer_get_char(app, &result.buffer, result.start - 1); - if (!char_is_alpha_numeric_utf8(prev)){ - result.end = - buffer_seek_alpha_numeric_end( - app, &result.buffer, result.start); - + }break; + + case SearchFlag_MatchSubstring: + { + result.end = result.start + word.size; if (result.end <= end_pos){ result.found_match = true; found_match = FindResult_FoundMatch; @@ -261,55 +304,53 @@ match_check(Application_Links *app, Search_Range *range, int32_t *pos, Search_Ma else{ found_match = FindResult_PastEnd; } - } - }break; + }break; + } - case SearchFlag_MatchSubstring: - { - result.end = result.start + word.size; - if (result.end <= end_pos){ - result.found_match = true; - found_match = FindResult_FoundMatch; - } - else{ - found_match = FindResult_PastEnd; - } - }break; + if (found_match == FindResult_FoundMatch){ + result_code = FindResult_FoundMatch; + result.match_word_index = i; + break; + } + else if (found_match == FindResult_PastEnd){ + result_code = FindResult_PastEnd; + } } *result_ptr = result; - return(found_match); + return(result_code); } +// +// Find Next Match +// + static int32_t -search_front_to_back_step(Application_Links *app, Search_Range *range, String word, int32_t *pos, Search_Match *result_ptr){ +search_front_to_back(Application_Links *app, Search_Range *range, Search_Key key, int32_t *pos, Search_Match *result){ int32_t found_match = FindResult_None; - - Search_Match result = *result_ptr; - - int32_t end_pos = range->start + range->size; - if (*pos + word.size < end_pos){ - int32_t start_pos = *pos; - if (start_pos < range->start){ - start_pos = range->start; - } + for (;found_match == FindResult_None;){ + found_match = FindResult_None; - int32_t case_insensitive = (range->flags & SearchFlag_CaseInsensitive); - - result.buffer = get_buffer(app, range->buffer, AccessAll); - if (case_insensitive){ - buffer_seek_string_insensitive_forward(app, &result.buffer, start_pos, end_pos, word.str, word.size, &result.start); - } - else{ - buffer_seek_string_forward(app, &result.buffer, start_pos, end_pos, word.str, word.size, &result.start); - } - - if (result.start < end_pos){ - *pos = result.start + 1; - found_match = match_check(app, range, pos, &result, word); - if (found_match == FindResult_FoundMatch){ - *pos = result.end; + int32_t end_pos = range->start + range->size; + if (*pos + key.min_size < end_pos){ + int32_t start_pos = *pos; + if (start_pos < range->start){ + start_pos = range->start; + } + + seek_potential_match(app, range, key, result, SeekPotentialMatch_Forward, start_pos, end_pos); + + if (result->start < end_pos){ + *pos = result->start + 1; + found_match = match_check(app, range, pos, result, key); + if (found_match == FindResult_FoundMatch){ + *pos = result->end; + } + } + else{ + found_match = FindResult_PastEnd; + *pos = end_pos + 1; } } else{ @@ -317,68 +358,43 @@ search_front_to_back_step(Application_Links *app, Search_Range *range, String wo *pos = end_pos + 1; } } - else{ - found_match = FindResult_PastEnd; - *pos = end_pos + 1; - } - - *result_ptr = result; - return(found_match); } static int32_t -search_front_to_back(Application_Links *app, Search_Range *range, String word, int32_t *pos, Search_Match *result_ptr){ +search_back_to_front(Application_Links *app, Search_Range *range, Search_Key key, int32_t *pos, Search_Match *result){ int32_t found_match = FindResult_None; for (;found_match == FindResult_None;){ - found_match = search_front_to_back_step(app, range, word, pos, result_ptr); - } - return(found_match); -} - -static int32_t -search_back_to_front_step(Application_Links *app, Search_Range *range, String word, int32_t *pos, Search_Match *result_ptr){ - int32_t found_match = FindResult_None; - - Search_Match result = *result_ptr; - - if (*pos > range->start){ - int32_t start_pos = *pos; - - result.buffer = get_buffer(app, range->buffer, AccessAll); - buffer_seek_string_backward(app, &result.buffer, - start_pos, range->start, - word.str, word.size, - &result.start); - - // TODO(allen): deduplicate the match checking code. - if (result.start >= range->start){ - *pos = result.start - 1; - found_match = match_check(app, range, pos, &result, word); - if (found_match == FindResult_FoundMatch){ - *pos = result.start - word.size; + found_match = FindResult_None; + if (*pos > range->start){ + int32_t start_pos = *pos; + + seek_potential_match(app, range, key, result, SeekPotentialMatch_Backward, start_pos, 0); + + if (result->start >= range->start){ + *pos = result->start - 1; + found_match = match_check(app, range, pos, result, key); + if (found_match == FindResult_FoundMatch){ + *pos = result->start - key.words[result->match_word_index].size; + } + } + else{ + found_match = FindResult_PastEnd; } } else{ found_match = FindResult_PastEnd; } } - else{ - found_match = FindResult_PastEnd; - } - - *result_ptr = result; - return(found_match); } -static int32_t -search_back_to_front(Application_Links *app, Search_Range *range, String word, int32_t *pos, Search_Match *result_ptr){ - int32_t found_match = FindResult_None; - for (;found_match == FindResult_None;){ - found_match = search_back_to_front_step(app, range, word, pos, result_ptr); - } - return(found_match); +static void +search_iter_next_range(Search_Iter *it){ + ++it->i; + it->pos = 0; + it->back_pos = 0; + it->range_initialized = 0; } static Search_Match @@ -411,12 +427,12 @@ search_next_match(Application_Links *app, Search_Set *set, Search_Iter *it_ptr){ switch (range->type){ case SearchRange_FrontToBack: { - find_result = search_front_to_back(app, range, iter.word, &iter.pos, &result); + find_result = search_front_to_back(app, range, iter.key, &iter.pos, &result); }break; case SearchRange_BackToFront: { - find_result = search_back_to_front(app, range, iter.word, &iter.back_pos, &result); + find_result = search_back_to_front(app, range, iter.key, &iter.back_pos, &result); }break; case SearchRange_Wave: @@ -428,11 +444,11 @@ search_next_match(Application_Links *app, Search_Set *set, Search_Iter *it_ptr){ int32_t backward_result = FindResult_PastEnd; if (iter.pos < range->start + range->size){ - forward_result = search_front_to_back(app, range, iter.word, &iter.pos, &forward_match); + forward_result = search_front_to_back(app, range, iter.key, &iter.pos, &forward_match); } if (iter.back_pos > range->start){ - backward_result = search_back_to_front(app, range, iter.word, &iter.back_pos, &backward_match); + backward_result = search_back_to_front(app, range, iter.key, &iter.back_pos, &backward_match); } if (forward_result == FindResult_FoundMatch){ @@ -489,29 +505,141 @@ search_next_match(Application_Links *app, Search_Set *set, Search_Iter *it_ptr){ // static void -get_search_all_string(Application_Links *app, Query_Bar *bar){ - char string_space[1024]; - bar->prompt = make_lit_string("List Locations For: "); - bar->string = make_fixed_width_string(string_space); +initialize_generic_search_all_buffers(Application_Links *app, General_Memory *general, String *strings, int32_t count, Search_Range_Flag match_flags, int32_t *skip_buffers, int32_t skip_buffer_count, Search_Set *set, Search_Iter *iter){ + memset(set, 0, sizeof(*set)); + memset(iter, 0, sizeof(*iter)); - if (!query_user_string(app, bar)){ - bar->string.size = 0; + Search_Key key = {0}; + int32_t sizes[ArrayCount(key.words)]; + memset(sizes, 0, sizeof(sizes)); + + if (count > ArrayCount(key.words)){ + count = ArrayCount(key.words); } + for (int32_t i = 0; i < count; ++i){ + sizes[i] = strings[i].size; + } + + // TODO(allen): Why on earth am I allocating these separately in this case? Upgrade to just use the string array on the stack! + search_key_alloc(general, &key, sizes, count); + for (int32_t i = 0; i < count; ++i){ + copy_ss(&key.words[i], strings[i]); + } + + search_iter_init(iter, key); + + int32_t buffer_count = get_buffer_count(app); + search_set_init(general, set, buffer_count); + + Search_Range *ranges = set->ranges; + + View_Summary view = get_active_view(app, AccessProtected); + Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); + + int32_t j = 0; + if (buffer.exists){ + bool32 skip = false; + for (int32_t i = 0; i < skip_buffer_count; ++i){ + if (buffer.buffer_id == skip_buffers[i]){ + skip = true; + break; + } + } + + if (!skip){ + ranges[0].type = SearchRange_FrontToBack; + ranges[0].flags = match_flags; + ranges[0].buffer = buffer.buffer_id; + ranges[0].start = 0; + ranges[0].size = buffer.size; + j = 1; + } + } + + for (Buffer_Summary buffer_it = get_buffer_first(app, AccessAll); + buffer_it.exists; + get_buffer_next(app, &buffer_it, AccessAll)){ + if (buffer.buffer_id != buffer_it.buffer_id){ + bool32 skip = false; + for (int32_t i = 0; i < skip_buffer_count; ++i){ + if (buffer.buffer_id == skip_buffers[i]){ + skip = true; + break; + } + } + + if (!skip){ + if (buffer_it.buffer_name[0] != '*'){ + ranges[j].type = SearchRange_FrontToBack; + ranges[j].flags = match_flags; + ranges[j].buffer = buffer_it.buffer_id; + ranges[j].start = 0; + ranges[j].size = buffer_it.size; + ++j; + } + } + } + } + set->count = j; +} + +// +// List all Locations +// + +static void +buffered_print_flush(Application_Links *app, Partition *part, Temp_Memory temp, Buffer_Summary *output_buffer){ + int32_t size = output_buffer->size; + int32_t write_size = part->pos - temp.pos; + char *str = part->base + temp.pos; + buffer_replace_range(app, output_buffer, size, size, str, write_size); } static void -generic_search_all_buffers(Application_Links *app, General_Memory *general, Partition *part, String string, uint32_t match_flags){ - Search_Set set = {0}; - Search_Iter iter = {0}; +buffered_print_match_jump_line(Application_Links *app, Partition *part, Temp_Memory temp, Partition *line_part, Buffer_Summary *output_buffer, Buffer_Summary *match_buffer, Partial_Cursor word_pos){ + char *file_name = match_buffer->buffer_name; + int32_t file_len = match_buffer->buffer_name_len; - search_iter_init(general, &iter, string.size); - copy_ss(&iter.word, string); + int32_t line_num_len = int_to_str_size(word_pos.line); + int32_t column_num_len = int_to_str_size(word_pos.character); - int32_t buffer_count = get_buffer_count(app); - search_set_init(general, &set, buffer_count); - - Search_Range *ranges = set.ranges; + Temp_Memory line_temp = begin_temp_memory(line_part); + String line_str = {0}; + if (read_line(app, line_part, match_buffer, word_pos.line, &line_str)){ + line_str = skip_chop_whitespace(line_str); + + int32_t str_len = file_len + 1 + line_num_len + 1 + column_num_len + 1 + 1 + line_str.size + 1; + + char *spare = push_array(part, char, str_len); + + if (spare == 0){ + buffered_print_flush(app, part, temp, output_buffer); + + end_temp_memory(temp); + temp = begin_temp_memory(part); + + spare = push_array(part, char, str_len); + } + + String out_line = make_string_cap(spare, 0, str_len); + append_ss(&out_line, make_string(file_name, file_len)); + append_s_char(&out_line, ':'); + append_int_to_str(&out_line, word_pos.line); + append_s_char(&out_line, ':'); + append_int_to_str(&out_line, word_pos.character); + append_s_char(&out_line, ':'); + append_s_char(&out_line, ' '); + append_ss(&out_line, line_str); + append_s_char(&out_line, '\n'); + Assert(out_line.size == str_len); + } + end_temp_memory(line_temp); +} + +static void +list_all_locations_parameters(Application_Links *app, General_Memory *general, Partition *part, String *strings, int32_t count, Search_Range_Flag match_flags){ + // Open the search buffer String search_name = make_lit_string("*search*"); Buffer_Summary search_buffer = get_buffer_by_name(app, search_name.str, search_name.size, AccessAll); if (!search_buffer.exists){ @@ -525,152 +653,106 @@ generic_search_all_buffers(Application_Links *app, General_Memory *general, Part buffer_replace_range(app, &search_buffer, 0, search_buffer.size, 0, 0); } - { - View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - - int32_t j = 0; - if (buffer.exists){ - if (buffer.buffer_id != search_buffer.buffer_id){ - ranges[0].type = SearchRange_FrontToBack; - ranges[0].flags = match_flags; - ranges[0].buffer = buffer.buffer_id; - ranges[0].start = 0; - ranges[0].size = buffer.size; - j = 1; - } - } - - for (Buffer_Summary buffer_it = get_buffer_first(app, AccessAll); - buffer_it.exists; - get_buffer_next(app, &buffer_it, AccessAll)){ - if (buffer.buffer_id != buffer_it.buffer_id){ - if (search_buffer.buffer_id != buffer_it.buffer_id){ - if (buffer_it.buffer_name[0] != '*'){ - ranges[j].type = SearchRange_FrontToBack; - ranges[j].flags = match_flags; - ranges[j].buffer = buffer_it.buffer_id; - ranges[j].start = 0; - ranges[j].size = buffer_it.size; - ++j; - } - } - } - } - set.count = j; - } + // Initialize a generic search all buffers + Search_Set set = {0}; + Search_Iter iter = {0}; + initialize_generic_search_all_buffers(app, general, strings, count, match_flags, &search_buffer.buffer_id, 1, &set, &iter); - Temp_Memory temp = begin_temp_memory(part); + // List all locations into search buffer + Temp_Memory all_temp = begin_temp_memory(part); Partition line_part = partition_sub_part(part, (4 << 10)); - char *str = (char*)partition_current(part); - int32_t part_size = 0; - int32_t size = 0; - for (;;){ - Search_Match match = search_next_match(app, &set, &iter); - if (match.found_match){ - Partial_Cursor word_pos = {0}; - if (buffer_compute_cursor(app, &match.buffer, seek_pos(match.start), &word_pos)){ - char *file_name = match.buffer.file_name; - int32_t file_len = match.buffer.file_name_len; - if (file_name != 0){ - file_name = match.buffer.buffer_name; - file_len = match.buffer.buffer_name_len; - } - - int32_t line_num_len = int_to_str_size(word_pos.line); - int32_t column_num_len = int_to_str_size(word_pos.character); - - Temp_Memory line_temp = begin_temp_memory(&line_part); - String line_str = {0}; - if (read_line(app, &line_part, &match.buffer, word_pos.line, &line_str)){ - line_str = skip_chop_whitespace(line_str); - - int32_t str_len = file_len + 1 + line_num_len + 1 + column_num_len + 1 + 1 + line_str.size + 1; - - char *spare = push_array(part, char, str_len); - - if (spare == 0){ - buffer_replace_range(app, &search_buffer, size, size, str, part_size); - size += part_size; - - end_temp_memory(temp); - temp = begin_temp_memory(part); - - part_size = 0; - spare = push_array(part, char, str_len); - } - - part_size += str_len; - - String out_line = make_string_cap(spare, 0, str_len); - append_ss(&out_line, make_string(file_name, file_len)); - append_s_char(&out_line, ':'); - append_int_to_str(&out_line, word_pos.line); - append_s_char(&out_line, ':'); - append_int_to_str(&out_line, word_pos.character); - append_s_char(&out_line, ':'); - append_s_char(&out_line, ' '); - append_ss(&out_line, line_str); - append_s_char(&out_line, '\n'); - Assert(out_line.size == str_len); - } - - end_temp_memory(line_temp); - } - } - else{ - break; + Temp_Memory temp = begin_temp_memory(part); + for (Search_Match match = search_next_match(app, &set, &iter); + match.found_match; + match = search_next_match(app, &set, &iter)){ + Partial_Cursor word_pos = {0}; + if (buffer_compute_cursor(app, &match.buffer, seek_pos(match.start), &word_pos)){ + buffered_print_match_jump_line(app, part, temp, &line_part, &search_buffer, &match.buffer, word_pos); } } - buffer_replace_range(app, &search_buffer, size, size, str, part_size); + buffered_print_flush(app, part, temp, &search_buffer); + end_temp_memory(all_temp); + // Lock this *search* as the jump buffer View_Summary view = get_active_view(app, AccessAll); view_set_buffer(app, &view, search_buffer.buffer_id, 0); - lock_jump_buffer(search_name.str, search_name.size); - - end_temp_memory(temp); } + // // List Commands // +static void +get_search_all_string(Application_Links *app, Query_Bar *bar, char *string_space, int32_t space_size){ + bar->prompt = make_lit_string("List Locations For: "); + bar->string = make_string_cap(string_space, 0, space_size); + + if (!query_user_string(app, bar)){ + bar->string.size = 0; + } +} + CUSTOM_COMMAND_SIG(list_all_locations) CUSTOM_DOC("Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.") { + char string_space[1024]; Query_Bar bar; - get_search_all_string(app, &bar); + get_search_all_string(app, &bar, string_space, sizeof(string_space)); if (bar.string.size == 0) return; - generic_search_all_buffers(app, &global_general, &global_part, bar.string, SearchFlag_MatchWholeWord); + list_all_locations_parameters(app, &global_general, &global_part, &bar.string, 1, SearchFlag_MatchWholeWord); } CUSTOM_COMMAND_SIG(list_all_substring_locations) CUSTOM_DOC("Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.") { + char string_space[1024]; Query_Bar bar; - get_search_all_string(app, &bar); + get_search_all_string(app, &bar, string_space, sizeof(string_space)); if (bar.string.size == 0) return; - generic_search_all_buffers(app, &global_general, &global_part, bar.string, SearchFlag_MatchSubstring); + list_all_locations_parameters(app, &global_general, &global_part, &bar.string, 1, SearchFlag_MatchSubstring); } CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive) CUSTOM_DOC("Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.") { + char string_space[1024]; Query_Bar bar; - get_search_all_string(app, &bar); + get_search_all_string(app, &bar, string_space, sizeof(string_space)); if (bar.string.size == 0) return; - generic_search_all_buffers(app, &global_general, &global_part, bar.string, SearchFlag_CaseInsensitive | SearchFlag_MatchWholeWord); + list_all_locations_parameters(app, &global_general, &global_part, &bar.string, 1, SearchFlag_CaseInsensitive | SearchFlag_MatchWholeWord); } CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive) CUSTOM_DOC("Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.") { + char string_space[1024]; Query_Bar bar; - get_search_all_string(app, &bar); + get_search_all_string(app, &bar, string_space, sizeof(string_space)); if (bar.string.size == 0) return; - generic_search_all_buffers(app, &global_general, &global_part, bar.string, SearchFlag_CaseInsensitive | SearchFlag_MatchSubstring); + list_all_locations_parameters(app, &global_general, &global_part, &bar.string, 1, SearchFlag_CaseInsensitive | SearchFlag_MatchSubstring); +} + +static String +get_token_or_word_under_pos(Application_Links *app, Buffer_Summary *buffer, int32_t pos, char *space, int32_t capacity){ + String result = {0}; + + Cpp_Get_Token_Result get_result = {0}; + bool32 success = buffer_get_token_index(app, buffer, pos, &get_result); + + if (success && !get_result.in_whitespace){ + int32_t size = get_result.token_end - get_result.token_start; + if (size > 0 && size <= capacity){ + success = buffer_read_range(app, buffer, get_result.token_start, get_result.token_end, space); + if (success){ + result = make_string(space, size); + } + } + } + + return(result); } static void @@ -678,32 +760,22 @@ list_all_locations_of_identifier_parameters(Application_Links *app, bool32 subst View_Summary view = get_active_view(app, AccessProtected); Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - Cpp_Get_Token_Result get_result = {0}; - bool32 success = buffer_get_token_index(app, &buffer, view.cursor.pos, &get_result); - - if (success && !get_result.in_whitespace){ - char space[256]; - int32_t size = get_result.token_end - get_result.token_start; + char space[512]; + String str = get_token_or_word_under_pos(app, &buffer, view.cursor.pos, space, sizeof(space)); + if (str.str != 0){ + change_active_panel(app); - if (size > 0 && size <= sizeof(space)){ - success = buffer_read_range(app, &buffer, get_result.token_start, get_result.token_end, space); - if (success){ - String str = make_string(space, size); - change_active_panel(app); - - uint32_t flags = 0; - if (substrings){ - flags |= SearchFlag_MatchSubstring; - } - else{ - flags |= SearchFlag_MatchWholeWord; - } - if (case_insensitive){ - flags |= SearchFlag_CaseInsensitive; - } - generic_search_all_buffers(app, &global_general, &global_part, str, flags); - } + Search_Range_Flag flags = 0; + if (substrings){ + flags |= SearchFlag_MatchSubstring; } + else{ + flags |= SearchFlag_MatchWholeWord; + } + if (case_insensitive){ + flags |= SearchFlag_CaseInsensitive; + } + list_all_locations_parameters(app, &global_general, &global_part, &str, 1, flags); } } @@ -738,7 +810,7 @@ list_all_locations_of_selection_parameters(Application_Links *app, bool32 substr if (buffer_read_range(app, &buffer, range.min, range.max, query_space)){ String query = make_string(query_space, query_length); - uint32_t flags = 0; + Search_Range_Flag flags = 0; if (substrings){ flags |= SearchFlag_MatchSubstring; } @@ -748,7 +820,7 @@ list_all_locations_of_selection_parameters(Application_Links *app, bool32 substr if (case_insensitive){ flags |= SearchFlag_CaseInsensitive; } - generic_search_all_buffers(app, &global_general, &global_part, query, flags); + list_all_locations_parameters(app, &global_general, &global_part, &query, 1, flags); } } @@ -767,6 +839,7 @@ CUSTOM_DOC("Reads the string in the selected range and lists all exact case-inse list_all_locations_of_selection_parameters(app, false, true); } + // // Word Complete Command // @@ -840,13 +913,14 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with return; } - // NOTE(allen): Initialize the search iterator - // with the partial word. + // NOTE(allen): Initialize the search iterator with the partial word. complete_state.initialized = true; - search_iter_init(&global_general, &complete_state.iter, size); - buffer_read_range(app, &buffer, word_start, word_end, - complete_state.iter.word.str); - complete_state.iter.word.size = size; + Search_Key key = {0}; + search_key_alloc(&global_general, &key, &size, 1); + buffer_read_range(app, &buffer, word_start, word_end, key.words[0].str); + key.words[0].size = size; + + search_iter_init(&complete_state.iter, key); // NOTE(allen): Initialize the set of ranges to be searched. int32_t buffer_count = get_buffer_count(app); @@ -877,11 +951,9 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with complete_state.set.count = j; // NOTE(allen): Initialize the search hit table. - search_hits_init(&global_general, &complete_state.hits, &complete_state.str, - 100, (4 << 10)); - search_hit_add(&global_general, &complete_state.hits, &complete_state.str, - complete_state.iter.word.str, - complete_state.iter.word.size); + search_hits_init(&global_general, &complete_state.hits, &complete_state.str, 100, (4 << 10)); + String word = complete_state.iter.key.words[0]; + search_hit_add(&global_general, &complete_state.hits, &complete_state.str, word.str, word.size); complete_state.word_start = word_start; complete_state.word_end = word_end; @@ -889,32 +961,25 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with else{ word_start = complete_state.word_start; word_end = complete_state.word_end; - size = complete_state.iter.word.size; + size = complete_state.iter.key.words[0].size; } // NOTE(allen): Iterate through matches. if (size > 0){ for (;;){ int32_t match_size = 0; - Search_Match match = - search_next_match(app, &complete_state.set, - &complete_state.iter); + Search_Match match = search_next_match(app, &complete_state.set, &complete_state.iter); if (match.found_match){ match_size = match.end - match.start; Temp_Memory temp = begin_temp_memory(&global_part); char *spare = push_array(&global_part, char, match_size); - buffer_read_range(app, &match.buffer, - match.start, match.end, spare); + buffer_read_range(app, &match.buffer, match.start, match.end, spare); - if (search_hit_add(&global_general, &complete_state.hits, &complete_state.str, - spare, match_size)){ - buffer_replace_range(app, &buffer, word_start, word_end, - spare, match_size); - view_set_cursor(app, &view, - seek_pos(word_start + match_size), - true); + if (search_hit_add(&global_general, &complete_state.hits, &complete_state.str, spare, match_size)){ + buffer_replace_range(app, &buffer, word_start, word_end, spare, match_size); + view_set_cursor(app, &view, seek_pos(word_start + match_size), true); complete_state.word_end = word_start + match_size; complete_state.set.ranges[0].mid_size = match_size; @@ -927,19 +992,14 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with complete_state.iter.pos = 0; complete_state.iter.i = 0; - search_hits_init(&global_general, &complete_state.hits, &complete_state.str, - 100, (4 << 10)); - search_hit_add(&global_general, &complete_state.hits, &complete_state.str, - complete_state.iter.word.str, - complete_state.iter.word.size); + search_hits_init(&global_general, &complete_state.hits, &complete_state.str, 100, (4 << 10)); + String word = complete_state.iter.key.words[0]; + search_hit_add(&global_general, &complete_state.hits, &complete_state.str, word.str, word.size); - match_size = complete_state.iter.word.size; - char *str = complete_state.iter.word.str; - buffer_replace_range(app, &buffer, word_start, word_end, - str, match_size); - view_set_cursor(app, &view, - seek_pos(word_start + match_size), - true); + match_size = word.size; + char *str = word.str; + buffer_replace_range(app, &buffer, word_start, word_end, str, match_size); + view_set_cursor(app, &view, seek_pos(word_start + match_size), true); complete_state.word_end = word_start + match_size; complete_state.set.ranges[0].mid_size = match_size; diff --git a/4coder_search.h b/4coder_search.h new file mode 100644 index 00000000..06b8c0f3 --- /dev/null +++ b/4coder_search.h @@ -0,0 +1,72 @@ +/* +4coder_search.h - Types that are used in the search accross all buffers procedures. + +TYPE: 'types-header' +*/ + +// TOP + +#if !defined(FCODER_SEARCH_H) +#define FCODER_SEARCH_H + +enum Search_Range_Type{ + SearchRange_FrontToBack, + SearchRange_BackToFront, + SearchRange_Wave, +}; + +typedef uint32_t Search_Range_Flag; +enum{ + SearchFlag_MatchWholeWord = 0x0000, + SearchFlag_MatchWordPrefix = 0x0001, + SearchFlag_MatchSubstring = 0x0002, + SearchFlag_MatchMask = 0x00FF, + SearchFlag_CaseInsensitive = 0x0100, +}; + +struct Search_Range{ + int32_t type; + uint32_t flags; + int32_t buffer; + int32_t start; + int32_t size; + int32_t mid_start; + int32_t mid_size; +}; + +struct Search_Set{ + Search_Range *ranges; + int32_t count; + int32_t max; +}; + +struct Search_Key{ + char *base; + int32_t base_size; + + String words[16]; + int32_t count; + + int32_t min_size; +}; + +struct Search_Iter{ + Search_Key key; + int32_t pos; + int32_t back_pos; + int32_t i; + int32_t range_initialized; +}; + +struct Search_Match{ + Buffer_Summary buffer; + int32_t start; + int32_t end; + int32_t match_word_index; + int32_t found_match; +}; + +#endif + +// BOTOTM + diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index 66e6550d..5d7961d7 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -832,8 +832,8 @@ generate_remapping_code_and_data(){ bind(mappings, 'y', MDFR_CTRL, redo); bind(mappings, 'z', MDFR_CTRL, undo); - bind(mappings, '2', MDFR_CTRL, decrease_line_wrap); - bind(mappings, '3', MDFR_CTRL, increase_line_wrap); + bind(mappings, '1', MDFR_CTRL, view_buffer_other_panel); + bind(mappings, '2', MDFR_CTRL, swap_buffers_between_panels); bind(mappings, '?', MDFR_CTRL, toggle_show_whitespace); bind(mappings, '~', MDFR_CTRL, clean_all_lines); @@ -868,6 +868,9 @@ generate_remapping_code_and_data(){ bind(mappings, 't', MDFR_ALT, write_todo); bind(mappings, 'y', MDFR_ALT, write_note); + bind(mappings, 'D', MDFR_ALT, list_all_locations_of_type_definition); + bind(mappings, 'T', MDFR_ALT, list_all_locations_of_type_definition_of_identifier); + bind(mappings, '[', MDFR_CTRL, open_long_braces); bind(mappings, '{', MDFR_CTRL, open_long_braces_semicolon); bind(mappings, '}', MDFR_CTRL, open_long_braces_break); @@ -1023,8 +1026,8 @@ generate_remapping_code_and_data(){ bind(mappings, 'y', MDFR_CMND, redo); bind(mappings, 'z', MDFR_CMND, undo); - bind(mappings, '2', MDFR_CMND, decrease_line_wrap); - bind(mappings, '3', MDFR_CMND, increase_line_wrap); + bind(mappings, '1', MDFR_CMND, view_buffer_other_panel); + bind(mappings, '2', MDFR_CMND, swap_buffers_between_panels); bind(mappings, '?', MDFR_CMND, toggle_show_whitespace); bind(mappings, '~', MDFR_CMND, clean_all_lines); @@ -1059,6 +1062,9 @@ generate_remapping_code_and_data(){ bind(mappings, 't', MDFR_CTRL, write_todo); bind(mappings, 'y', MDFR_CTRL, write_note); + bind(mappings, 'D', MDFR_CTRL, list_all_locations_of_type_definition); + bind(mappings, 'T', MDFR_CTRL, list_all_locations_of_type_definition_of_identifier); + bind(mappings, '[', MDFR_CMND, open_long_braces); bind(mappings, '{', MDFR_CMND, open_long_braces_semicolon); bind(mappings, '}', MDFR_CMND, open_long_braces_break); diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index d7096806..3427f731 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -232,7 +232,6 @@ system_schedule_step(){ //////////////////////////////// -// HACK(allen): Get this shit working more properly (look at pens) internal void win32_toggle_fullscreen(){ HWND win = win32vars.window_handle; diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index e88744e6..6cd8a501 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -246,7 +246,7 @@ CUSTOM_COMMAND_SIG(multi_paste){ } static Range -multi_paste_range(Application_Links *app, View_Summary *view, Range range, int32_t paste_count){ +multi_paste_range(Application_Links *app, View_Summary *view, Range range, int32_t paste_count, bool32 old_to_new){ Range finish_range = range; if (paste_count >= 1){ Buffer_Summary buffer = get_buffer(app, view->buffer_id, AccessOpen); @@ -260,8 +260,19 @@ multi_paste_range(Application_Links *app, View_Summary *view, Range range, int32 if (total_size <= app->memory_size){ char *str = (char*)app->memory; int32_t position = 0; - for (int32_t paste_index = paste_count - 1; paste_index >= 0; --paste_index){ - if (paste_index != paste_count - 1){ + + int32_t first = paste_count - 1; + int32_t one_past_last = -1; + int32_t step = -1; + + if (!old_to_new){ + first = 0; + one_past_last = paste_count; + step = 1; + } + + for (int32_t paste_index = first; paste_index != one_past_last; paste_index += step){ + if (paste_index != first){ str[position] = '\n'; ++position; } @@ -288,53 +299,86 @@ multi_paste_range(Application_Links *app, View_Summary *view, Range range, int32 return(finish_range); } +static void +multi_paste_interactive_up_down(Application_Links *app, int32_t paste_count, int32_t clip_count){ + View_Summary view = get_active_view(app, AccessOpen); + + Range range = {0}; + range.min = range.max = view.cursor.pos; + + bool32 old_to_new = true; + + range = multi_paste_range(app, &view, range, paste_count, old_to_new); + + Query_Bar bar = {0}; + bar.prompt = make_lit_string("Up and Down to condense and expand paste stages; R to reverse order; Return to finish; Escape to abort."); + if (start_query_bar(app, &bar, 0) == 0) return; + + User_Input in = {0}; + for (;;){ + in = get_user_input(app, EventOnAnyKey, EventOnEsc); + if (in.abort) break; + Assert(in.type == UserInputKey); + + bool32 did_modify = false; + if (in.key.keycode == key_up){ + if (paste_count > 1){ + --paste_count; + did_modify = true; + } + } + else if (in.key.keycode == key_down){ + if (paste_count < clip_count){ + ++paste_count; + did_modify = true; + } + } + else if (in.key.keycode == 'r' || in.key.keycode == 'R'){ + old_to_new = !old_to_new; + did_modify = true; + } + else if (in.key.keycode == '\n'){ + break; + } + + if (did_modify){ + range = multi_paste_range(app, &view, range, paste_count, old_to_new); + } + } + + if (in.abort){ + Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); + } +} + CUSTOM_COMMAND_SIG(multi_paste_interactive){ int32_t clip_count = clipboard_count(app, 0); if (clip_count > 0){ - View_Summary view = get_active_view(app, AccessOpen); - - int32_t paste_count = 1; - Range range = {0}; - range.min = range.max = view.cursor.pos; - - range = multi_paste_range(app, &view, range, paste_count); - + multi_paste_interactive_up_down(app, 1, clip_count); + } +} + +CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){ + int32_t clip_count = clipboard_count(app, 0); + if (clip_count > 0){ + char string_space[256]; Query_Bar bar = {0}; - bar.prompt = make_lit_string("Up and Down to condense and expand paste stages; Return to finish; Escape to abort."); - if (start_query_bar(app, &bar, 0) == 0) return; + bar.prompt = make_lit_string("How Many Slots To Paste: "); + bar.string = make_fixed_width_string(string_space); + query_user_number(app, &bar); - User_Input in = {0}; - for (;;){ - in = get_user_input(app, EventOnAnyKey, EventOnEsc); - if (in.abort) break; - Assert(in.type == UserInputKey); - - bool32 did_modify = false; - if (in.key.keycode == key_up){ - if (paste_count > 1){ - --paste_count; - did_modify = true; - } - } - else if (in.key.keycode == key_down){ - if (paste_count < clip_count){ - ++paste_count; - did_modify = true; - } - } - else if (in.key.keycode == '\n'){ - break; - } - - if (did_modify){ - range = multi_paste_range(app, &view, range, paste_count); - } + int32_t initial_paste_count = str_to_int_s(bar.string); + if (initial_paste_count > clip_count){ + initial_paste_count = clip_count; + } + if (initial_paste_count < 1){ + initial_paste_count = 1; } - if (in.abort){ - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); - } + end_query_bar(app, &bar, 0); + + multi_paste_interactive_up_down(app, initial_paste_count, clip_count); } } @@ -493,9 +537,14 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in end_temp_memory(temp); } -CUSTOM_COMMAND_SIG(write_explicit_enum_values) -CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.") -{ +typedef uint32_t Write_Explicit_Enum_Values_Mode; +enum{ + WriteExplicitEnumValues_Integers, + WriteExplicitEnumValues_Flags, +}; + +static void +write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enum_Values_Mode mode){ uint32_t access = AccessOpen; View_Summary view = get_active_view(app, access); Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); @@ -551,7 +600,11 @@ CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the v closed_correctly = false; still_looping = false; - int32_t value = 0; + uint32_t value = 0; + if (mode == WriteExplicitEnumValues_Flags){ + value = 1; + } + do{ for (;token_index < stream.end; ++token_index){ Cpp_Token *token_ptr = stream.tokens + token_index; @@ -595,7 +648,15 @@ CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the v if (closed_correctly){ append(&string, "\n"); } - ++value; + + if (mode == WriteExplicitEnumValues_Integers){ + ++value; + } + else if (mode == WriteExplicitEnumValues_Flags){ + if (value < (1 << 31)){ + value <<= 1; + } + } int32_t str_size = string.size - str_pos; @@ -639,6 +700,104 @@ CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the v end_temp_memory(temp); } +CUSTOM_COMMAND_SIG(write_explicit_enum_values) +CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.") +{ + write_explicit_enum_values_parameters(app, WriteExplicitEnumValues_Integers); +} + +CUSTOM_COMMAND_SIG(write_explicit_enum_flags) +CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.") +{ + write_explicit_enum_values_parameters(app, WriteExplicitEnumValues_Flags); +} + +// +// Rename All +// + +struct Replace_Target{ + Buffer_ID buffer_id; + int32_t start_pos; +}; + +static void +replace_all_occurrences_parameters(Application_Links *app, General_Memory *general, Partition *part, String target_string, String new_string){ + if (target_string.size <= 0) return; + + for (bool32 got_all_occurrences = false; + !got_all_occurrences;){ + // Initialize a generic search all buffers + Search_Set set = {0}; + Search_Iter iter = {0}; + initialize_generic_search_all_buffers(app, general, &target_string, 1, SearchFlag_MatchSubstring, 0, 0, &set, &iter); + + // Visit all locations and create replacement list + Temp_Memory temp = begin_temp_memory(part); + Replace_Target *targets = push_array(part, Replace_Target, 0); + int32_t target_count = 0; + + got_all_occurrences = true; + for (Search_Match match = search_next_match(app, &set, &iter); + match.found_match; + match = search_next_match(app, &set, &iter)){ + + Replace_Target *new_target= push_array(part, Replace_Target, 1); + if (new_target != 0){ + new_target->buffer_id = match.buffer.buffer_id; + new_target->start_pos = match.start; + ++target_count; + } + else{ + if (!has_substr(new_string, target_string)){ + got_all_occurrences = false; + } + else{ + print_message(app, literal("Could not replace all occurrences, ran out of memory\n")); + } + break; + } + } + + // Use replacement list to do replacements + for (int32_t i = 0; i < target_count; ++i){ + Replace_Target *target = &targets[i]; + Buffer_Summary buffer= get_buffer(app, target->buffer_id, AccessOpen); + buffer_replace_range(app, &buffer, target->start_pos, target->start_pos + target_string.size, new_string.str, new_string.size); + } + + end_temp_memory(temp); + } +} + +CUSTOM_COMMAND_SIG(replace_all_occurrences) +CUSTOM_DOC("Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.") +{ + Query_Bar replace; + char replace_space[1024]; + replace.prompt = make_lit_string("Replace (In All Buffers): "); + replace.string = make_fixed_width_string(replace_space); + + Query_Bar with; + char with_space[1024]; + with.prompt = make_lit_string("With: "); + with.string = make_fixed_width_string(with_space); + + if (!query_user_string(app, &replace)) return; + if (replace.string.size == 0) return; + + if (!query_user_string(app, &with)) return; + + String r = replace.string; + String w = with.string; + + replace_all_occurrences_parameters(app, &global_general, &global_part, r, w); +} + +// +// Self training to stop typing Ctrl+S +// + CUSTOM_COMMAND_SIG(punishment){ Theme_Color colors[4]; colors[0].tag = Stag_Back; @@ -698,12 +857,14 @@ get_bindings(void *data, int32_t size){ bind(context, key_home, MDFR_ALT, miblo_increment_time_stamp_minute); bind(context, key_end, MDFR_ALT, miblo_decrement_time_stamp_minute); - bind(context, 'b', MDFR_CTRL, multi_paste_interactive); + bind(context, 'b', MDFR_CTRL, multi_paste_interactive_quick); + bind(context, 'A', MDFR_CTRL, replace_all_occurrences); end_map(context); begin_map(context, default_code_map); bind(context, key_insert, MDFR_CTRL, write_explicit_enum_values); + bind(context, key_insert, MDFR_CTRL|MDFR_SHIFT, write_explicit_enum_flags); bind(context, 'p', MDFR_ALT, rename_parameter); end_map(context);