diff --git a/4coder_auto_indent.cpp b/4coder_auto_indent.cpp index f7fbb2f6..ff56f268 100644 --- a/4coder_auto_indent.cpp +++ b/4coder_auto_indent.cpp @@ -1,39 +1,17 @@ /* 4coder_auto_indent.cpp - Commands for auto-indentation of C++ code. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_AUTO_INDENT_CPP) -#define FCODER_AUTO_INDENT_CPP - -#include "4coder_base_commands.cpp" -#include "4coder_helper/4coder_streaming.h" -#include "4coder_helper/4coder_long_seek.h" -#include "4coder_lib/4coder_mem.h" -#include "4coder_default_framework.h" - #if !defined(DEFAULT_INDENT_FLAGS) -# define DEFAULT_INDENT_FLAGS 0 +# define DEFAULT_INDENT_FLAGS false #endif #if !defined(DEF_TAB_WIDTH) # define DEF_TAB_WIDTH 4 #endif -// -// Wrapper Implementation -// - -struct Hard_Start_Result{ - int32_t char_pos; - int32_t indent_pos; - int32_t all_whitespace; - int32_t all_space; -}; - static Hard_Start_Result buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, int32_t line_start, int32_t tab_width){ tab_width -= 1; @@ -79,34 +57,25 @@ buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, int32_t l return(result); } -struct Indent_Options{ - bool32 empty_blank_lines; - bool32 use_tabs; - int32_t tab_width; -}; - static Buffer_Batch_Edit -make_batch_from_indent_marks(Application_Links *app, Partition *part, Buffer_Summary *buffer, int32_t line_start, int32_t line_end, int32_t *indent_marks, Indent_Options opts){ +make_batch_from_indent_marks(Application_Links *app, Partition *arena, Buffer_Summary *buffer, + int32_t first_line, int32_t one_past_last_line, + int32_t *indent_marks, Indent_Options opts){ + int32_t *shifted_indent_marks = indent_marks - first_line; - Buffer_Batch_Edit result = {0}; - - int32_t edit_max = line_end - line_start; int32_t edit_count = 0; + int32_t edit_max = one_past_last_line - first_line; + Buffer_Edit *edits = push_array(arena, Buffer_Edit, edit_max); - Buffer_Edit *edits = push_array(part, Buffer_Edit, edit_max); + char *str_base = push_array(arena, char, 0); - char *str_base = (char*)part->base + part->pos; - int32_t str_size = 0; - - // NOTE(allen): Shift the array so that line_i can just operate in - // it's natural value range. - indent_marks -= line_start; - - for (int32_t line_i = line_start; line_i < line_end; ++line_i){ - int32_t line_start_pos = buffer_get_line_start(app, buffer, line_i); + for (int32_t line_number = first_line; + line_number < one_past_last_line; + ++line_number){ + int32_t line_start_pos = buffer_get_line_start(app, buffer, line_number); Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, line_start_pos, opts.tab_width); - int32_t correct_indentation = indent_marks[line_i]; + int32_t correct_indentation = shifted_indent_marks[line_number]; if (hard_start.all_whitespace && opts.empty_blank_lines){ correct_indentation = 0; } @@ -114,30 +83,33 @@ make_batch_from_indent_marks(Application_Links *app, Partition *part, Buffer_Sum correct_indentation = hard_start.indent_pos; } - // TODO(allen): Only replace spaces if we are using space based indentation. - if (!hard_start.all_space || correct_indentation != hard_start.indent_pos){ - Buffer_Edit new_edit; - new_edit.str_start = str_size; - str_size += correct_indentation; - char *str = push_array(part, char, correct_indentation); - int32_t j = 0; - + if (correct_indentation != hard_start.indent_pos){ + int32_t str_size = correct_indentation; if (opts.use_tabs){ - int32_t i = 0; - for (; i + opts.tab_width <= correct_indentation; i += opts.tab_width){ + str_size = correct_indentation/opts.tab_width + correct_indentation%opts.tab_width; + } + char *str = push_array(arena, char, str_size); + if (opts.use_tabs){ + int32_t indent = 0; + int32_t j = 0; + for (;indent + opts.tab_width <= correct_indentation; + indent += opts.tab_width){ str[j++] = '\t'; } - for (; i < correct_indentation; ++i){ + for (;indent < correct_indentation; + indent += 1){ str[j++] = ' '; } } else{ - for (; j < correct_indentation; ++j){ - str[j] = ' '; + for (int32_t j = 0; j < correct_indentation;){ + str[j++] = ' '; } } - new_edit.len = j; + Buffer_Edit new_edit; + new_edit.str_start = (int32_t)(str - str_base); + new_edit.len = str_size; new_edit.start = line_start_pos; new_edit.end = hard_start.char_pos; edits[edit_count++] = new_edit; @@ -146,26 +118,31 @@ make_batch_from_indent_marks(Application_Links *app, Partition *part, Buffer_Sum Assert(edit_count <= edit_max); } + Buffer_Batch_Edit result = {0}; result.str = str_base; - result.str_len = str_size; - + result.str_len = (int32_t)(push_array(arena, char, 0) - str_base); result.edits = edits; result.edit_count = edit_count; - return(result); } static void -set_line_indents(Application_Links *app, Partition *part, Buffer_Summary *buffer, int32_t line_start, int32_t line_end, int32_t *indent_marks, Indent_Options opts){ - Buffer_Batch_Edit batch = make_batch_from_indent_marks(app, part, buffer, line_start, line_end, indent_marks, opts); - +set_line_indents(Application_Links *app, Partition *part, Buffer_Summary *buffer, + int32_t first_line, int32_t one_past_last_line, + int32_t *indent_marks, Indent_Options opts){ + Buffer_Batch_Edit batch = make_batch_from_indent_marks(app, part, buffer, + first_line, one_past_last_line, + indent_marks, opts); if (batch.edit_count > 0){ - buffer_batch_edit(app, buffer, batch.str, batch.str_len, batch.edits, batch.edit_count, BatchEdit_PreserveTokens); + buffer_batch_edit(app, buffer, + batch.str, batch.str_len, batch.edits, batch.edit_count, + BatchEdit_PreserveTokens); } } static Cpp_Token* -seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token, Cpp_Token_Type open_type, Cpp_Token_Type close_type){ +seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token, + Cpp_Token_Type open_type, Cpp_Token_Type close_type){ if (token <= tokens.tokens){ token = tokens.tokens; } @@ -190,18 +167,19 @@ seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token, Cpp_Toke return(token); } -static Cpp_Token* -find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, int32_t line_start, int32_t tab_width, int32_t *current_indent_out){ +static Indent_Anchor_Position +find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, + int32_t line_start, int32_t tab_width){ #if 1 // NOTE(allen): New implementation of find_anchor_token (4.0.26) revert if it is a problem. - Cpp_Token *token = 0; + Indent_Anchor_Position anchor = {0}; + if (tokens.count > 0){ Cpp_Token *first_invalid_token = get_first_token_at_line(app, buffer, tokens, line_start); if (first_invalid_token <= tokens.tokens){ - token = tokens.tokens; + anchor.token = tokens.tokens; } else{ - int32_t stack[256]; int32_t top = -1; @@ -212,7 +190,7 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra if (highest_checked_line_number < line_number){ highest_checked_line_number = line_number; if (top == -1){ - token = token_it; + anchor.token = token_it; } } @@ -268,24 +246,23 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra } } } - return(token); + return(anchor); #else // NOTE(allen): Old (4.0.25) implementation of find_anchor_token. - Cpp_Token *token = 0; + Indent_Anchor_Position anchor = {0}; if (tokens.count != 0){ - token = get_first_token_at_line(app, buffer, tokens, line_start); - - if (token == 0){ - token = tokens.tokens + (tokens.count - 1); + anchor.token = get_first_token_at_line(app, buffer, tokens, line_start); + if (anchor.token == 0){ + anchor.token = tokens.tokens + (tokens.count - 1); } - if (token > tokens.tokens){ - --token; - for (; token > tokens.tokens; --token){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - switch(token->type){ + if (anchor.token > tokens.tokens){ + --anchor.token; + for (; anchor.token > tokens.tokens; --anchor.token){ + if (!(anchor.token->flags & CPP_TFLAG_PP_BODY)){ + switch(anchor.token->type){ case CPP_TOKEN_BRACE_OPEN: case CPP_TOKEN_BRACE_CLOSE: goto out_of_loop; @@ -298,33 +275,35 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra int32_t current_indent = 0; int32_t found_safe_start_position = 0; do{ - int32_t line = buffer_get_line_number(app, buffer, token->start); + int32_t line = buffer_get_line_number(app, buffer, anchor.token->start); int32_t start = buffer_get_line_start(app, buffer, line); Hard_Start_Result hard_start = buffer_find_hard_start(app, buffer, start, tab_width); current_indent = hard_start.indent_pos; Cpp_Token *start_token = get_first_token_at_line(app, buffer, tokens, line); - Cpp_Token *brace_token = token; + Cpp_Token *brace_token = anchor.token; if (start_token->type == CPP_TOKEN_PARENTHESE_OPEN){ if (start_token == tokens.tokens){ found_safe_start_position = true; } else{ - token = start_token - 1; + anchor.token = start_token - 1; } } else{ int32_t close = 0; - for (token = brace_token; token > start_token; --token){ - switch(token->type){ + for (anchor.token = brace_token; + anchor.token > start_token; + --anchor.token){ + switch (anchor.token->type){ case CPP_TOKEN_PARENTHESE_CLOSE: case CPP_TOKEN_BRACKET_CLOSE: case CPP_TOKEN_BRACE_CLOSE: { - close = token->type; + close = anchor.token->type; }goto out_of_loop2; } } @@ -335,7 +314,7 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra switch (close){ case 0: { - token = start_token; + anchor.token = start_token; found_safe_start_position = true; }break; @@ -358,46 +337,41 @@ find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Arra }break; } if (open_type != CPP_TOKEN_JUNK){ - token = seek_matching_token_backwards(tokens, token-1, open_type, close_type); + anchor.token = seek_matching_token_backwards(tokens, anchor.token - 1, open_type, close_type); } } } while(found_safe_start_position == 0); - *current_indent_out = current_indent; + anchor.indentation = current_indent; } - return(token); + return(anchor); #endif } -struct Indent_Parse_State{ - int32_t current_indent; - int32_t previous_line_indent; - int32_t paren_nesting; - int32_t paren_anchor_indent[16]; - int32_t comment_shift; - int32_t previous_comment_indent; -}; - 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); +get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary *buffer, + Cpp_Token_Array tokens, int32_t first_line, int32_t one_past_last_line, + bool32 exact_align, int32_t tab_width){ + int32_t indent_mark_count = one_past_last_line - first_line; + int32_t *indent_marks = push_array(arena, int32_t, indent_mark_count); // Shift the array so line_index works correctly. - indent_marks -= line_start; + indent_marks -= first_line; // Decide where to start indentation parsing. + Indent_Anchor_Position anchor = find_anchor_token(app, buffer, tokens, first_line, tab_width); + Cpp_Token *token_ptr = anchor.token; Indent_Parse_State indent = {0}; - Cpp_Token *token_ptr = find_anchor_token(app, buffer, tokens, line_start, tab_width, &indent.current_indent); + indent.current_indent = anchor.indentation; if (token_ptr == 0){ - for (int32_t line_index = line_start; line_index < line_end; ++line_index){ + for (int32_t line_index = first_line; line_index < one_past_last_line; ++line_index){ indent_marks[line_index] = 0; } } else{ int32_t line_number = buffer_get_line_number(app, buffer, token_ptr->start); - if (line_number > line_start){ - line_number = line_start; + if (line_number > first_line){ + line_number = first_line; } if (token_ptr == tokens.tokens){ @@ -419,7 +393,7 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b // LOOP OVER TOKENS for (;;){ - if (line_number >= line_end){ + if (line_number >= one_past_last_line){ break; } @@ -434,7 +408,7 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b token.flags = 0; } - for (;token.start >= next_line_start_pos && line_number < line_end;){ + for (;token.start >= next_line_start_pos && line_number < one_past_last_line;){ next_line_start_pos = buffer_get_line_start(app, buffer, line_number + 1); int32_t this_indent = 0; @@ -467,7 +441,7 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b } if (!hard_start.all_whitespace){ - if (line_number >= line_start){ + if (line_number >= first_line){ indent.previous_comment_indent = this_indent; } else{ @@ -567,7 +541,7 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b } } - if (line_number >= line_start){ + if (line_number >= first_line){ indent_marks[line_number] = this_indent; } ++line_number; @@ -629,7 +603,7 @@ get_indentation_marks(Application_Links *app, Partition *part, Buffer_Summary *b } // Unshift the indent_marks array. - indent_marks += line_start; + indent_marks += first_line; return(indent_marks); } @@ -786,7 +760,5 @@ CUSTOM_DOC("Inserts a character and auto-indents the line on which the cursor si move_past_lead_whitespace(app, &view, &buffer); } -#endif - // BOTTOM diff --git a/4coder_auto_indent.h b/4coder_auto_indent.h new file mode 100644 index 00000000..88bc062b --- /dev/null +++ b/4coder_auto_indent.h @@ -0,0 +1,40 @@ +/* +4coder_auto_indent.h - Auto-indentation types. +*/ + +// TOP + +#if !defined(FCODER_AUTO_INDENT_H) +#define FCODER_AUTO_INDENT_H + +struct Hard_Start_Result{ + int32_t char_pos; + int32_t indent_pos; + int32_t all_whitespace; + int32_t all_space; +}; + +struct Indent_Options{ + bool32 empty_blank_lines; + bool32 use_tabs; + int32_t tab_width; +}; + +struct Indent_Parse_State{ + int32_t current_indent; + int32_t previous_line_indent; + int32_t paren_nesting; + int32_t paren_anchor_indent[16]; + int32_t comment_shift; + int32_t previous_comment_indent; +}; + +struct Indent_Anchor_Position{ + Cpp_Token *token; + int32_t indentation; +}; + +#endif + +// BOTTOM + diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 29c74203..42098d96 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -1,20 +1,10 @@ /* 4coder_base_commands.cpp - Base commands such as inserting characters, and moving the cursor, which work even without the default 4coder framework. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_BASE_COMMANDS_CPP) -#define FCODER_BASE_COMMANDS_CPP - -#include "4coder_helper/4coder_helper.h" -#include "4coder_helper/4coder_long_seek.h" - -#include "4coder_lib/4coder_utf8.h" - // // Fundamental Editing Commands // @@ -1297,7 +1287,5 @@ CUSTOM_DOC("Opens the 4coder colors and fonts selector menu.") exec_command(app, cmdid_open_color_tweaker); } -#endif - // BOTTOM diff --git a/4coder_build_commands.cpp b/4coder_build_commands.cpp index 1109f573..93df02a7 100644 --- a/4coder_build_commands.cpp +++ b/4coder_build_commands.cpp @@ -1,18 +1,9 @@ /* 4coder_build_commands.cpp - Commands for building. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_BUILD_COMMANDS_CPP) -#define FCODER_BUILD_COMMANDS_CPP - -#include "4coder_helper/4coder_helper.h" - -#include "4coder_default_framework.h" - // NOTE(allen|a4.0.9): This is provided to establish a default method of getting // a "build directory". This function tries to setup the build directory in the // directory of the given buffer, if it cannot get that information it get's the @@ -20,12 +11,6 @@ TYPE: 'drop-in-command-pack' // // There is no requirement that a custom build system in 4coder actually use the // directory given by this function. -enum Get_Build_Directory_Result{ - BuildDir_None, - BuildDir_AtFile, - BuildDir_AtHot -}; - static int32_t get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_out){ int32_t result = BuildDir_None; @@ -240,7 +225,5 @@ CUSTOM_DOC("If the special build panel is open, makes the build panel the active } } -#endif - // BOTTOM diff --git a/4coder_build_commands.h b/4coder_build_commands.h new file mode 100644 index 00000000..e556fd7b --- /dev/null +++ b/4coder_build_commands.h @@ -0,0 +1,18 @@ +/* +4coder_build_commands.h - Commands for building types. +*/ + +// TOP + +#if !defined(FCODER_BUILD_COMMANDS_H) +#define FCODER_BUILD_COMMANDS_H + +enum Get_Build_Directory_Result{ + BuildDir_None, + BuildDir_AtFile, + BuildDir_AtHot +}; + +#endif + +// BOTTOM \ No newline at end of file diff --git a/4coder_clipboard.cpp b/4coder_clipboard.cpp index 0f029fa8..72a6f660 100644 --- a/4coder_clipboard.cpp +++ b/4coder_clipboard.cpp @@ -1,18 +1,9 @@ /* 4coder_clipboard.cpp - Copy paste commands and clipboard related setup. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_CLIPBOARD_CPP) -#define FCODER_CLIPBOARD_CPP - -#include "4coder_default_framework.h" - -#include "4coder_helper/4coder_helper.h" - static bool32 clipboard_copy(Application_Links *app, int32_t start, int32_t end, Buffer_Summary *buffer_out, uint32_t access){ View_Summary view = get_active_view(app, access); @@ -149,7 +140,5 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste } } -#endif - // BOTTOM diff --git a/4coder_default_bindings.cpp b/4coder_default_bindings.cpp index b87c2e85..285e626f 100644 --- a/4coder_default_bindings.cpp +++ b/4coder_default_bindings.cpp @@ -1,13 +1,11 @@ /* 4coder_default_bidings.cpp - Supplies the default bindings used for default 4coder behavior. - -TYPE: 'build-target' */ // TOP -#if !defined(FCODER_DEFAULT_BINDINGS) -#define FCODER_DEFAULT_BINDINGS +#if !defined(FCODER_DEFAULT_BINDINGS_CPP) +#define FCODER_DEFAULT_BINDINGS_CPP #include "4coder_default_include.cpp" diff --git a/4coder_default_framework.cpp b/4coder_default_framework.cpp new file mode 100644 index 00000000..3019ac23 --- /dev/null +++ b/4coder_default_framework.cpp @@ -0,0 +1,1285 @@ +/* +4coder_default_framework.cpp - Sets up the basics of the framework that is used for default 4coder behaviour. +*/ + +// TOP + +static Partition global_part; +static General_Memory global_general; + + +#if !defined(AUTO_CENTER_AFTER_JUMPS) +#define AUTO_CENTER_AFTER_JUMPS true +#endif +static bool32 auto_center_after_jumps = AUTO_CENTER_AFTER_JUMPS; +static char locked_buffer_space[256]; +static String locked_buffer = make_fixed_width_string(locked_buffer_space); + + +static View_ID special_note_view_id = 0; + + +static bool32 default_use_scrollbars = false; +static bool32 default_use_file_bars = true; + + +View_Paste_Index view_paste_index_[16]; +View_Paste_Index *view_paste_index = view_paste_index_ - 1; + + +static char out_buffer_space[1024]; +static char command_space[1024]; +static char hot_directory_space[1024]; + + +static bool32 suppressing_mouse = false; + + +static ID_Based_Jump_Location prev_location = {0}; + + +static Named_Mapping *named_maps = 0; +static int32_t named_map_count = 0; + + +static bool32 enable_code_wrapping = true; +static bool32 automatically_adjust_wrapping = true; +static bool32 automatically_indent_text_on_save = true; +static bool32 automatically_save_changes_on_build = true; +static int32_t default_wrap_width = 672; +static int32_t default_min_base_width = 550; +static char default_theme_name_space[256] = {0}; +static String default_theme_name = make_fixed_width_string(default_theme_name_space); +static char default_font_name_space[256] = {0}; +static String default_font_name = make_fixed_width_string(default_font_name_space); +static char user_name_space[256] = {0}; +static String user_name = make_fixed_width_string(user_name_space); +static bool32 automatically_load_project = false; +static char default_compiler_bat_space[256]; +static String default_compiler_bat = make_fixed_width_string(default_compiler_bat_space); +static char default_flags_bat_space[1024]; +static String default_flags_bat = make_fixed_width_string(default_flags_bat_space); +static char default_compiler_sh_space[256]; +static String default_compiler_sh = make_fixed_width_string(default_compiler_sh_space); +static char default_flags_sh_space[1024]; +static String default_flags_sh = make_fixed_width_string(default_flags_sh_space); + + +static char *default_extensions[] = { + "cpp", + "hpp", + "c", + "h", + "cc", + "cs", +}; +static Extension_List treat_as_code_exts = {0}; + +//////////////////////////////// + +static void +unlock_jump_buffer(void){ + locked_buffer.size = 0; +} + +static void +lock_jump_buffer(char *name, int32_t size){ + if (size <= locked_buffer.memory_size){ + copy(&locked_buffer, make_string(name, size)); + } +} + +static void +lock_jump_buffer(Buffer_Summary buffer){ + lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len); +} + +static View_Summary +get_view_for_locked_jump_buffer(Application_Links *app){ + View_Summary view = {0}; + if (locked_buffer.size > 0){ + Buffer_Summary buffer = get_buffer_by_name(app, locked_buffer.str, locked_buffer.size, AccessAll); + if (buffer.exists){ + view = get_first_view_with_buffer(app, buffer.buffer_id); + } + else{ + unlock_jump_buffer(); + } + } + return(view); +} + +//////////////////////////////// + +static void +new_view_settings(Application_Links *app, View_Summary *view){ + if (!default_use_scrollbars){ + view_set_setting(app, view, ViewSetting_ShowScrollbar, false); + } + if (!default_use_file_bars){ + view_set_setting(app, view, ViewSetting_ShowFileBar, false); + } +} + +static void +close_special_note_view(Application_Links *app){ + View_Summary special_view = get_view(app, special_note_view_id, AccessAll); + if (special_view.exists){ + close_view(app, &special_view); + } + special_note_view_id = 0; +} + +static View_Summary +open_special_note_view(Application_Links *app, bool32 create_if_not_exist = true){ + View_Summary special_view = get_view(app, special_note_view_id, AccessAll); + if (create_if_not_exist && !special_view.exists){ + View_Summary view = get_active_view(app, AccessAll); + special_view = open_view(app, &view, ViewSplit_Bottom); + new_view_settings(app, &special_view); + view_set_split_proportion(app, &special_view, .2f); + set_active_view(app, &view); + special_note_view_id = special_view.view_id; + } + return(special_view); +} + +CUSTOM_COMMAND_SIG(change_active_panel) +CUSTOM_DOC("Change the currently active panel, moving to the panel with the next highest view_id.") +{ + View_Summary view = get_active_view(app, AccessAll); + View_ID original_view_id = view.view_id; + + do{ + get_view_next_looped(app, &view, AccessAll); + if (view.view_id != special_note_view_id){ + break; + } + }while(view.view_id != original_view_id); + + if (view.exists){ + set_active_view(app, &view); + } +} + +CUSTOM_COMMAND_SIG(change_active_panel_backwards) +CUSTOM_DOC("Change the currently active panel, moving to the panel with the next lowest view_id.") +{ + View_Summary view = get_active_view(app, AccessAll); + View_ID original_view_id = view.view_id; + + do{ + get_view_prev_looped(app, &view, AccessAll); + if (view.view_id != special_note_view_id){ + break; + } + }while(view.view_id != original_view_id); + + if (view.exists){ + set_active_view(app, &view); + } +} + +CUSTOM_COMMAND_SIG(open_panel_vsplit) +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) +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); +} + +//////////////////////////////// + +static void +set_mouse_suppression(Application_Links *app, int32_t suppress){ + if (suppress){ + suppressing_mouse = 1; + show_mouse_cursor(app, MouseCursorShow_Never); + } + else{ + suppressing_mouse = 0; + show_mouse_cursor(app, MouseCursorShow_Always); + } +} + +CUSTOM_COMMAND_SIG(suppress_mouse) +CUSTOM_DOC("Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.") +{ + set_mouse_suppression(app, true); +} + +CUSTOM_COMMAND_SIG(allow_mouse) +CUSTOM_DOC("Shows the mouse and causes all mouse input to be processed normally.") +{ + set_mouse_suppression(app, false); +} + +CUSTOM_COMMAND_SIG(toggle_mouse) +CUSTOM_DOC("Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.") +{ + set_mouse_suppression(app, !suppressing_mouse); +} + +CUSTOM_COMMAND_SIG(toggle_fullscreen) +CUSTOM_DOC("Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.") +{ + set_fullscreen(app, !is_fullscreen(app)); +} + +//////////////////////////////// + +static Cpp_Token +read_config_token(Cpp_Token_Array array, int32_t *i_ptr){ + Cpp_Token token = {0}; + int32_t i = *i_ptr; + for (; i < array.count; ++i){ + Cpp_Token comment_token = array.tokens[i]; + if (comment_token.type != CPP_TOKEN_COMMENT){ + break; + } + } + if (i < array.count){ + token = array.tokens[i]; + } + *i_ptr = i; + return(token); +} + +static Config_Line +read_config_line(Cpp_Token_Array array, int32_t *i_ptr, char *text){ + Config_Line config_line = {0}; + + int32_t i = *i_ptr; + config_line.id_token = read_config_token(array, &i); + int32_t text_index_start = config_line.id_token.start; + if (config_line.id_token.type == CPP_TOKEN_IDENTIFIER){ + ++i; + if (i < array.count){ + Cpp_Token token = read_config_token(array, &i); + + bool32 lvalue_success = true; + if (token.type == CPP_TOKEN_BRACKET_OPEN){ + lvalue_success = false; + ++i; + if (i < array.count){ + config_line.subscript_token = read_config_token(array, &i); + if (config_line.subscript_token.type == CPP_TOKEN_INTEGER_CONSTANT){ + ++i; + if (i < array.count){ + token = read_config_token(array, &i); + if (token.type == CPP_TOKEN_BRACKET_CLOSE){ + ++i; + if (i < array.count){ + token = read_config_token(array, &i); + lvalue_success = true; + } + } + } + } + } + } + + if (lvalue_success){ + if (token.type == CPP_TOKEN_EQ){ + config_line.eq_token = read_config_token(array, &i); + ++i; + if (i < array.count){ + Cpp_Token val_token = read_config_token(array, &i); + + bool32 rvalue_success = true; + if (val_token.type == CPP_TOKEN_BRACE_OPEN){ + rvalue_success = false; + ++i; + if (i < array.count){ + config_line.val_array_start = i; + + bool32 expecting_array_item = 1; + for (; i < array.count; ++i){ + Cpp_Token array_token = read_config_token(array, &i); + if (array_token.size == 0){ + break; + } + if (array_token.type == CPP_TOKEN_BRACE_CLOSE){ + config_line.val_array_end = i; + rvalue_success = true; + break; + } + else{ + if (array_token.type == CPP_TOKEN_COMMA){ + if (!expecting_array_item){ + expecting_array_item = true; + } + else{ + break; + } + } + else{ + if (expecting_array_item){ + expecting_array_item = false; + ++config_line.val_array_count; + } + } + } + } + } + } + + if (rvalue_success){ + config_line.val_token = val_token; + ++i; + if (i < array.count){ + Cpp_Token semicolon_token = read_config_token(array, &i); + if (semicolon_token.type == CPP_TOKEN_SEMICOLON){ + config_line.read_success = true; + } + } + } + } + } + } + } + } + + if (!config_line.read_success){ + Cpp_Token token = {0}; + if (i < array.count){ + token = array.tokens[i]; + } + int32_t text_index_current = token.start + token.size; + if (text_index_current <= text_index_start){ + if (array.count > 0){ + token = array.tokens[array.count - 1]; + text_index_current = token.start + token.size; + } + } + + if (text_index_current > text_index_start){ + config_line.error_str = make_string(text + text_index_start, text_index_current - text_index_start); + } + + for (; i < array.count; ++i){ + Cpp_Token skip_token = read_config_token(array, &i); + if (skip_token.type == CPP_TOKEN_SEMICOLON){ + break; + } + } + } + + *i_ptr = i; + + return(config_line); +} + +static Config_Item +get_config_item(Config_Line line, char *mem, Cpp_Token_Array array){ + Config_Item item = {0}; + item.line = line; + item.array = array; + item.mem = mem; + if (line.id_token.size != 0){ + item.id = make_string(mem + line.id_token.start, line.id_token.size); + } + + if (line.subscript_token.size != 0){ + String subscript_str = make_string(mem + line.subscript_token.start,line.subscript_token.size); + item.subscript_index = str_to_int_s(subscript_str); + item.has_subscript = 1; + } + + return(item); +} + +static bool32 +config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_type, void *var_out){ + bool32 result = false; + bool32 subscript_success = true; + if (item.line.val_token.type == token_type){ + if ((var_name == 0 && item.id.size == 0) || match(item.id, var_name)){ + if (subscript){ + if (item.has_subscript){ + *subscript = item.subscript_index; + } + else{ + subscript_success = false; + } + } + + if (subscript_success){ + if (var_out){ + switch (token_type){ + case CPP_TOKEN_BOOLEAN_CONSTANT: + { + *(bool32*)var_out = (item.mem[item.line.val_token.start] == 't'); + }break; + + case CPP_TOKEN_INTEGER_CONSTANT: + { + if (match(make_string(item.mem + item.line.val_token.start, 2), "0x")){ + // Hex Integer + String val = make_string(item.mem + item.line.val_token.start + 2, item.line.val_token.size - 2); + *(uint32_t*)var_out = hexstr_to_int(val); + } + else{ + // Integer + String val = make_string(item.mem + item.line.val_token.start, item.line.val_token.size); + *(int32_t*)var_out = str_to_int(val); + } + }break; + + case CPP_TOKEN_STRING_CONSTANT: + { + String str = make_string(item.mem + item.line.val_token.start + 1,item.line.val_token.size - 2); + copy((String*)var_out, str); + }break; + + case CPP_TOKEN_IDENTIFIER: + { + String str = make_string(item.mem + item.line.val_token.start,item.line.val_token.size); + copy((String*)var_out, str); + }break; + + case CPP_TOKEN_BRACE_OPEN: + { + Config_Array_Reader *array_reader = (Config_Array_Reader*)var_out; + array_reader->array = item.array; + array_reader->mem = item.mem; + array_reader->i = item.line.val_array_start; + array_reader->val_array_end = item.line.val_array_end; + array_reader->good = 1; + }break; + } + } + result = true; + } + } + } + return(result); +} + +static bool32 +config_bool_var(Config_Item item, char *var_name, int32_t *subscript, bool32 *var_out){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BOOLEAN_CONSTANT, var_out); + return(result); +} + +static bool32 +config_int_var(Config_Item item, char *var_name, int32_t *subscript, int32_t *var_out){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out); + return(result); +} + +static bool32 +config_uint_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t *var_out){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out); + return(result); +} + +static bool32 +config_string_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_STRING_CONSTANT, var_out); + return(result); +} + +static bool32 +config_identifier_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_IDENTIFIER, var_out); + return(result); +} + +static bool32 +config_array_var(Config_Item item, char *var_name, int32_t *subscript, Config_Array_Reader *array_reader){ + bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BRACE_OPEN, array_reader); + return(result); +} + +static bool32 +config_array_next_item(Config_Array_Reader *array_reader, Config_Item *item){ + bool32 result = false; + + for (;array_reader->i < array_reader->val_array_end; + ++array_reader->i){ + Cpp_Token array_token = read_config_token(array_reader->array, &array_reader->i); + if (array_token.size == 0 || array_reader->i >= array_reader->val_array_end){ + break; + } + + if (array_token.type == CPP_TOKEN_BRACE_CLOSE){ + break; + } + + switch (array_token.type){ + case CPP_TOKEN_BOOLEAN_CONSTANT: + case CPP_TOKEN_INTEGER_CONSTANT: + case CPP_TOKEN_STRING_CONSTANT: + { + Config_Line line = {0}; + line.val_token = array_token; + line.read_success = 1; + *item = get_config_item(line, array_reader->mem, array_reader->array); + result = true; + ++array_reader->i; + goto doublebreak; + }break; + } + } + doublebreak:; + + array_reader->good = result; + return(result); +} + +static bool32 +config_array_good(Config_Array_Reader *array_reader){ + bool32 result = (array_reader->good); + return(result); +} + +//////////////////////////////// + +static void +lexer_keywords_default_init(Partition *part, Cpp_Keyword_Table *kw_out, Cpp_Keyword_Table *pp_out){ + umem_4tech kw_size = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS); + umem_4tech pp_size = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES); + + void *kw_mem = push_block(part, (i32_4tech)kw_size); + void *pp_mem = push_block(part, (i32_4tech)pp_size); + + *kw_out = cpp_make_table_default(CPP_TABLE_KEYWORDS, kw_mem, kw_size); + *pp_out = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, pp_mem, pp_size); +} + +//////////////////////////////// + +static void +change_mapping(Application_Links *app, String mapping){ + bool32 did_remap = false; + for (int32_t i = 0; i < named_map_count; ++i){ + if (match(mapping, named_maps[i].name)){ + did_remap = true; + exec_command(app, named_maps[i].remap_command); + break; + } + } + if (!did_remap){ + print_message(app, literal("Leaving bindings unaltered.\n")); + } +} + +CUSTOM_COMMAND_SIG(remap_interactive) +CUSTOM_DOC("Switch to a named key binding map.") +{ + Query_Bar bar = {0}; + char space[1024]; + bar.prompt = make_lit_string("Map Name: "); + bar.string = make_fixed_width_string(space); + if (!query_user_string(app, &bar)) return; + change_mapping(app, bar.string); +} + +//////////////////////////////// + +static bool32 +get_current_name(char **name_out, int32_t *len_out){ + bool32 result = false; + *name_out = 0; + if (user_name.str[0] != 0){ + *name_out = user_name.str; + *len_out = user_name.size; + result = true; + } + return(result); +} + +static String +get_default_theme_name(void){ + String str = default_theme_name; + if (str.size == 0){ + str = make_lit_string("4coder"); + } + return(str); +} + +static String +get_default_font_name(void){ + String str = default_font_name; + if (str.size == 0){ + str = make_lit_string("Liberation Mono"); + } + return(str); +} + +//////////////////////////////// + +static CString_Array +get_code_extensions(Extension_List *list){ + CString_Array array = {0}; + array.strings = default_extensions; + array.count = ArrayCount(default_extensions); + if (list->count != 0){ + array.strings = list->exts; + array.count = list->count; + } + return(array); +} + +static void +parse_extension_line_to_extension_list(String str, Extension_List *list){ + int32_t mode = 0; + int32_t j = 0, k = 0; + for (int32_t i = 0; i < str.size; ++i){ + switch (mode){ + case 0: + { + if (str.str[i] == '.'){ + mode = 1; + list->exts[k++] = &list->space[j]; + } + }break; + + case 1: + { + if (str.str[i] == '.'){ + list->space[j++] = 0; + list->exts[k++] = &list->space[j]; + } + else{ + list->space[j++] = str.str[i]; + } + }break; + } + } + list->space[j++] = 0; + list->count = k; +} + +//////////////////////////////// + +// TODO(allen): Stop handling files this way! My own API should be able to do this!!?!?!?!!?!?!!!!? +// NOTE(allen): Actually need binary buffers for some stuff to work, but not this parsing thing here. +#include + +static String +dump_file_handle(Partition *arena, FILE *file){ + String str = {0}; + if (file != 0){ + fseek(file, 0, SEEK_END); + int32_t size = ftell(file); + char *mem = push_array(arena, char, size + 1); + push_align(arena, 8); + if (mem != 0){ + fseek(file, 0, SEEK_SET); + fread(mem, 1, size, file); + mem[size] = 0; + str = make_string_cap(mem, size, size + 1); + } + } + return(str); +} + +static FILE* +open_file_search_up_path(Partition *scratch, String path, String file_name){ + Temp_Memory temp = begin_temp_memory(scratch); + + int32_t cap = path.size + file_name.size + 2; + char *space = push_array(scratch, char, cap); + String name_str = make_string_cap(space, 0, cap); + append(&name_str, path); + if (name_str.size == 0 || !char_is_slash(name_str.str[name_str.size - 1])){ + append(&name_str, "/"); + } + + FILE *file = 0; + for (;;){ + int32_t base_size = name_str.size; + append(&name_str, file_name); + terminate_with_null(&name_str); + file = fopen(name_str.str, "rb"); + if (file != 0){ + break; + } + + name_str.size = base_size; + remove_last_folder(&name_str); + if (name_str.size >= base_size){ + break; + } + } + + end_temp_memory(temp); + return(file); +} + +static char* +get_null_terminated(Partition *scratch, String name){ + char *name_terminated = 0; + if (name.size < name.memory_size){ + terminate_with_null(&name); + name_terminated = name.str; + } + else{ + name_terminated = push_array(scratch, char, name.size + 1); + if (name_terminated != 0){ + memcpy(name_terminated, name.str, name.size); + name_terminated[name.size] = 0; + } + } + return(name_terminated); +} + +static FILE* +open_file(Partition *scratch, String name){ + FILE *file = 0; + Temp_Memory temp = begin_temp_memory(scratch); + char *name_terminated = get_null_terminated(scratch, name); + if (name_terminated != 0){ + file = fopen(name_terminated, "rb"); + } + end_temp_memory(temp); + return(file); +} + +static String +dump_file(Partition *arena, String name){ + String result = {0}; + FILE *file = open_file(arena, name); + if (file != 0){ + result = dump_file_handle(arena, file); + fclose(file); + } + return(result); +} + +static String +dump_file_search_up_path(Partition *arena, String path, String file_name){ + String result = {0}; + FILE *file = open_file_search_up_path(arena, path, file_name); + if (file != 0){ + result = dump_file_handle(arena, file); + fclose(file); + } + return(result); +} + +/////////////////////////////// + +static void +process_config_data(Application_Links *app, Partition *scratch, String data){ + Cpp_Token_Array array = {0}; + array.count = 0; + array.max_count = (1 << 20)/sizeof(Cpp_Token); + array.tokens = push_array(scratch, Cpp_Token, array.max_count); + + if (array.tokens != 0){ + Cpp_Keyword_Table kw_table = {0}; + Cpp_Keyword_Table pp_table = {0}; + lexer_keywords_default_init(scratch, &kw_table, &pp_table); + + Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); + Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); + + if (result == LexResult_Finished){ + int32_t new_wrap_width = default_wrap_width; + int32_t new_min_base_width = default_min_base_width; + bool32 lalt_lctrl_is_altgr = false; + + for (int32_t i = 0; i < array.count; ++i){ + Config_Line config_line = read_config_line(array, &i, data.str); + + if (config_line.read_success){ + Config_Item item = get_config_item(config_line, data.str, array); + + config_bool_var(item, "enable_code_wrapping", 0, &enable_code_wrapping); + config_bool_var(item, "automatically_adjust_wrapping", 0, &automatically_adjust_wrapping); + config_bool_var(item, "automatically_indent_text_on_save", 0, &automatically_indent_text_on_save); + config_bool_var(item, "automatically_save_changes_on_build", 0, &automatically_save_changes_on_build); + + config_int_var(item, "default_wrap_width", 0, &new_wrap_width); + config_int_var(item, "default_min_base_width", 0, &new_min_base_width); + + config_string_var(item, "default_theme_name", 0, &default_theme_name); + config_string_var(item, "default_font_name", 0, &default_font_name); + config_string_var(item, "user_name", 0, &user_name); + + config_string_var(item, "default_compiler_bat", 0, &default_compiler_bat); + config_string_var(item, "default_flags_bat", 0, &default_flags_bat); + config_string_var(item, "default_compiler_sh", 0, &default_compiler_sh); + config_string_var(item, "default_flags_sh", 0, &default_flags_sh); + + char str_space[512]; + String str = make_fixed_width_string(str_space); + if (config_string_var(item, "mapping", 0, &str)){ + change_mapping(app, str); + } + + if (config_string_var(item, "treat_as_code", 0, &str)){ + parse_extension_line_to_extension_list(str, &treat_as_code_exts); + } + + config_bool_var(item, "automatically_load_project", 0, &automatically_load_project); + + config_bool_var(item, "lalt_lctrl_is_altgr", 0, &lalt_lctrl_is_altgr); + } + else if (config_line.error_str.str != 0){ + char space[2048]; + String str = make_fixed_width_string(space); + copy(&str, "WARNING: bad syntax in 4coder.config at "); + append(&str, config_line.error_str); + append(&str, "\n"); + print_message(app, str.str, str.size); + } + } + + adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width); + default_wrap_width = new_wrap_width; + default_min_base_width = new_min_base_width; + global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, lalt_lctrl_is_altgr); + } + } + else{ + print_message(app, literal("Ran out of memory processing config.4coder\n")); + } +} + +static void +process_config_file(Application_Links *app){ + static bool32 has_initialized = false; + if (!has_initialized){ + has_initialized = true; + copy(&default_compiler_bat, "cl"); + copy(&default_flags_bat, ""); + copy(&default_compiler_sh, "g++"); + copy(&default_flags_bat, ""); + } + + Partition *part = &global_part; + FILE *file = fopen("config.4coder", "rb"); + + if (file == 0){ + char space[256]; + int32_t size = get_4ed_path(app, space, sizeof(space)); + print_message(app, space, size); + String str = make_string_cap(space, size, sizeof(space)); + append_sc(&str, "/config.4coder"); + terminate_with_null(&str); + file = fopen(str.str, "rb"); + } + + if (file != 0){ + Temp_Memory temp = begin_temp_memory(part); + String data = dump_file_handle(part, file); + if (data.str != 0){ + process_config_data(app, part, data); + } + end_temp_memory(temp); + fclose(file); + } + else{ + print_message(app, literal("Did not find config.4coder, using default settings\n")); + } +} + +//////////////////////////////// + +static bool32 +load_color_theme_data(Application_Links *app, Partition *scratch, + char *file_name, String data){ + bool32 success = false; + + Cpp_Token_Array array; + array.count = 0; + array.max_count = (1 << 20)/sizeof(Cpp_Token); + array.tokens = push_array(scratch, Cpp_Token, array.max_count); + + Cpp_Keyword_Table kw_table = {0}; + Cpp_Keyword_Table pp_table = {0}; + lexer_keywords_default_init(scratch, &kw_table, &pp_table); + + Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); + Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); + + if (result == LexResult_Finished){ + success = true; + + char name_space[512]; + String name_str = make_fixed_width_string(name_space); + Theme theme; + init_theme_zero(&theme); + + for (int32_t i = 0; i < array.count; ++i){ + Config_Line config_line = read_config_line(array, &i, data.str); + if (config_line.read_success){ + Config_Item item = get_config_item(config_line, data.str, array); + config_string_var(item, "name", 0, &name_str); + + for (int32_t tag = 0; tag < ArrayCount(style_tag_names); ++tag){ + char *name = style_tag_names[tag]; + int_color color = 0; + if (config_uint_var(item, name, 0, &color)){ + int_color *color_slot = &theme.colors[tag]; + *color_slot = color; + } + else{ + char var_space[512]; + String var_str = make_fixed_width_string(var_space); + if (config_identifier_var(item, name, 0, &var_str)){ + for (int32_t eq_tag = 0; eq_tag < ArrayCount(style_tag_names); ++eq_tag){ + if (match(var_str, style_tag_names[eq_tag])){ + int_color *color_slot = &theme.colors[tag]; + *color_slot = theme.colors[eq_tag]; + break; + } + } + } + } + } + } + else if (config_line.error_str.str != 0){ + char space[2048]; + String str = make_fixed_width_string(space); + copy(&str, "WARNING: bad syntax in 4coder.config at "); + append(&str, config_line.error_str); + append(&str, "\n"); + print_message(app, str.str, str.size); + } + } + + if (name_str.size == 0){ + copy(&name_str, file_name); + } + + create_theme(app, &theme, name_str.str, name_str.size); + } + + return(success); +} + +static void +load_color_theme_file(Application_Links *app, char *file_name){ + Partition *part = &global_part; + FILE *file = fopen(file_name, "rb"); + + if (file == 0){ + char space[256]; + int32_t size = get_4ed_path(app, space, sizeof(space)); + String str = make_string_cap(space, size, sizeof(space)); + append_sc(&str, "/"); + append_sc(&str, file_name); + terminate_with_null(&str); + file = fopen(str.str, "rb"); + } + + if (file != 0){ + Temp_Memory temp = begin_temp_memory(part); + String data = dump_file_handle(part, file); + bool32 success = false; + if (data.str != 0){ + success = load_color_theme_data(app, part, file_name, data); + } + end_temp_memory(temp); + fclose(file); + + if (!success){ + char space[256]; + String str = make_fixed_width_string(space); + append_sc(&str, "Could not parse "); + append_sc(&str, file_name); + append_sc(&str, ", color scheme not loaded"); + print_message(app, str.str, str.size); + } + } + else{ + char space[256]; + String str = make_fixed_width_string(space); + append_sc(&str, "Did not find "); + append_sc(&str, file_name); + append_sc(&str, ", color scheme not loaded"); + print_message(app, str.str, str.size); + } +} + +static void +load_themes_folder(Application_Links *app){ + char folder_name_space[512]; + String folder_name = make_fixed_width_string(folder_name_space); + folder_name.size = get_4ed_path(app, folder_name_space, sizeof(folder_name_space)); + append(&folder_name, "themes"); + + if (folder_name.size < folder_name.memory_size){ + File_List list = get_file_list(app, folder_name.str, folder_name.size); + for (uint32_t i = 0; i < list.count; ++i){ + File_Info *info = &list.infos[i]; + if (!info->folder){ + char file_name_space[512]; + String file_name = make_fixed_width_string(file_name_space); + copy(&file_name, folder_name); + append(&file_name, "/"); + append(&file_name, make_string(info->filename, info->filename_len)); + if (file_name.size < file_name.memory_size){ + terminate_with_null(&file_name); + load_color_theme_file(app, file_name.str); + } + } + } + free_file_list(app, list); + } +} + +//////////////////////////////// + +static bool32 +descriptions_match(Face_Description *a, Face_Description *b){ + bool32 result = false; + if (match(a->font.name, b->font.name) && a->font.in_local_font_folder == b->font.in_local_font_folder){ + if (memcmp((&a->pt_size), (&b->pt_size), sizeof(*a) - sizeof(a->font)) == 0){ + result = true; + } + } + return(result); +} + +static Face_ID +get_existing_face_id_matching_name(Application_Links *app, char *name, int32_t len){ + String name_str = make_string(name, len); + Face_ID largest_id = get_largest_face_id(app); + Face_ID result = 0; + for (Face_ID id = 1; id <= largest_id; ++id){ + Face_Description compare = get_face_description(app, id); + if (match(compare.font.name, name_str)){ + result = id; + break; + } + } + return(result); +} + +static Face_ID +get_existing_face_id_matching_description(Application_Links *app, Face_Description *description){ + Face_ID largest_id = get_largest_face_id(app); + Face_ID result = 0; + for (Face_ID id = 1; id <= largest_id; ++id){ + Face_Description compare = get_face_description(app, id); + if (descriptions_match(&compare, description)){ + result = id; + break; + } + } + return(result); +} + +static Face_ID +get_face_id_by_name(Application_Links *app, char *name, int32_t len, Face_Description *base_description){ + Face_ID new_id = 0; + + String str = make_string(name, len); + if (!match(str, base_description->font.name)){ + new_id = get_existing_face_id_matching_name(app, name, len); + if (new_id == 0){ + Face_Description description = *base_description; + copy_fast_unsafe_cs(description.font.name, str); + description.font.name[str.size] = 0; + + description.font.in_local_font_folder = false; + new_id = try_create_new_face(app, &description); + if (new_id == 0){ + description.font.in_local_font_folder = true; + new_id = try_create_new_face(app, &description); + } + } + } + + return(new_id); +} + +static void +change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_buffers){ + Face_ID global_face_id = get_face_id(app, 0); + Face_Description description = get_face_description(app, global_face_id); + Face_ID new_id = get_face_id_by_name(app, name, len, &description); + if (new_id != 0){ + set_global_face(app, new_id, apply_to_all_buffers); + } +} + +static void +buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){ + Face_ID current_id = get_face_id(app, buffer); + if (current_id != 0){ + Face_Description description = get_face_description(app, current_id); + Face_ID new_id = get_face_id_by_name(app, name, len, &description); + if (new_id != 0){ + buffer_set_face(app, buffer, new_id); + } + } +} + +static Face_ID +get_face_id_by_description(Application_Links *app, Face_Description *description, Face_Description *base_description){ + Face_ID new_id = 0; + + if (!descriptions_match(description, base_description)){ + new_id = get_existing_face_id_matching_description(app, description); + if (new_id == 0){ + new_id = try_create_new_face(app, description); + } + } + + return(new_id); +} + +static void +change_face_description(Application_Links *app, Face_Description *new_description, bool32 apply_to_all_buffers){ + Face_ID global_face_id = get_face_id(app, 0); + Face_Description old_description = get_face_description(app, global_face_id); + Face_ID new_id = get_face_id_by_description(app, new_description, &old_description); + if (new_id != 0){ + set_global_face(app, new_id, apply_to_all_buffers); + } +} + +static void +buffer_set_face_description(Application_Links *app, Buffer_Summary *buffer, Face_Description *new_description){ + Face_ID current_id = get_face_id(app, buffer); + if (current_id != 0){ + Face_Description old_description = get_face_description(app, current_id); + Face_ID new_id = get_face_id_by_description(app, new_description, &old_description); + if (new_id != 0){ + buffer_set_face(app, buffer, new_id); + } + } +} + +static Face_Description +get_buffer_face_description(Application_Links *app, Buffer_Summary *buffer){ + Face_ID current_id = get_face_id(app, buffer); + Face_Description description = {0}; + if (current_id != 0){ + description = get_face_description(app, current_id); + } + return(description); +} + +static Face_Description +get_global_face_description(Application_Links *app){ + Face_ID current_id = get_face_id(app, 0); + Face_Description description = get_face_description(app, current_id); + return(description); +} + +//////////////////////////////// + +static void +init_memory(Application_Links *app){ + int32_t part_size = (32 << 20); + int32_t general_size = (4 << 20); + + void *part_mem = memory_allocate(app, part_size); + global_part = make_part(part_mem, part_size); + + void *general_mem = memory_allocate(app, general_size); + general_memory_open(&global_general, general_mem, general_size); +} + +static void +default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){ + init_memory(app); + process_config_file(app); + load_themes_folder(app); + + String theme = get_default_theme_name(); + String font = get_default_font_name(); + + change_theme(app, theme.str, theme.size); + change_font(app, font.str, font.size, true); + + default_use_scrollbars = use_scrollbars; + default_use_file_bars = use_file_bars; +} + +static void +default_4coder_initialize(Application_Links *app){ + default_4coder_initialize(app, false, true); +} + +static void +default_4coder_side_by_side_panels(Application_Links *app, Buffer_Identifier left_buffer, Buffer_Identifier right_buffer){ + Buffer_ID left_id = buffer_identifier_to_id(app, left_buffer); + Buffer_ID right_id = buffer_identifier_to_id(app, right_buffer); + + // Left Panel + View_Summary view = get_active_view(app, AccessAll); + new_view_settings(app, &view); + view_set_buffer(app, &view, left_id, 0); + + // Right Panel + open_panel_vsplit(app); + View_Summary right_view = get_active_view(app, AccessAll); + view_set_buffer(app, &right_view, right_id, 0); + + // Restore Active to Left + set_active_view(app, &view); +} + +static void +default_4coder_side_by_side_panels(Application_Links *app, char **command_line_files, int32_t file_count){ + Buffer_Identifier left = buffer_identifier(literal("*scratch*")); + Buffer_Identifier right = buffer_identifier(literal("*messages*")); + + if (file_count > 0){ + char *left_name = command_line_files[0]; + int32_t left_len = str_size(left_name); + left = buffer_identifier(left_name, left_len); + + if (file_count > 1){ + char *right_name = command_line_files[1]; + int32_t right_len = str_size(right_name); + right = buffer_identifier(right_name, right_len); + } + } + + default_4coder_side_by_side_panels(app, left, right); +} + +static void +default_4coder_side_by_side_panels(Application_Links *app){ + default_4coder_side_by_side_panels(app, 0, 0); +} + +static void +default_4coder_one_panel(Application_Links *app, Buffer_Identifier buffer){ + Buffer_ID id = buffer_identifier_to_id(app, buffer); + + View_Summary view = get_active_view(app, AccessAll); + new_view_settings(app, &view); + view_set_buffer(app, &view, id, 0); +} + +static void +default_4coder_one_panel(Application_Links *app, char **command_line_files, int32_t file_count){ + Buffer_Identifier buffer = buffer_identifier(literal("*messages*")); + + if (file_count > 0){ + char *name = command_line_files[0]; + int32_t len = str_size(name); + buffer = buffer_identifier(name, len); + } + + default_4coder_one_panel(app, buffer); +} + +static void +default_4coder_one_panel(Application_Links *app){ + default_4coder_one_panel(app, 0, 0); +} + +// BOTTOM + diff --git a/4coder_default_framework.h b/4coder_default_framework.h index b1080412..4b36f664 100644 --- a/4coder_default_framework.h +++ b/4coder_default_framework.h @@ -1,7 +1,5 @@ /* 4coder_default_framework.cpp - Sets up the basics of the framework that is used for default 4coder behaviour. - -TYPE: 'internal-for-default-system' */ // TOP @@ -9,176 +7,16 @@ TYPE: 'internal-for-default-system' #if !defined(FCODER_DEFAULT_FRAMEWORK_H) #define FCODER_DEFAULT_FRAMEWORK_H -#include "4coder_base_commands.cpp" - #include "4coder_helper/4coder_helper.h" #include "4coder_lib/4coder_mem.h" #include "4coder_lib/4cpp_lexer.h" -// -// Command Maps -// - enum Default_Maps{ default_code_map, default_maps_count, }; -// -// Global Memory -// - -static Partition global_part; -static General_Memory global_general; - -// -// Jump Buffer Locking -// - -#if !defined(AUTO_CENTER_AFTER_JUMPS) -static bool32 auto_center_after_jumps = true; -#else -static bool32 auto_center_after_jumps = AUTO_CENTER_AFTER_JUMPS; -#endif - -static char locked_buffer_space[256]; -static String locked_buffer = make_fixed_width_string(locked_buffer_space); - -static void -unlock_jump_buffer(){ - locked_buffer.size = 0; -} - -static void -lock_jump_buffer(char *name, int32_t size){ - if (size <= locked_buffer.memory_size){ - copy(&locked_buffer, make_string(name, size)); - } -} - -static void -lock_jump_buffer(Buffer_Summary buffer){ - lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len); -} - -static View_Summary -get_view_for_locked_jump_buffer(Application_Links *app){ - View_Summary view = {0}; - - if (locked_buffer.size > 0){ - Buffer_Summary buffer = get_buffer_by_name(app, locked_buffer.str, locked_buffer.size, AccessAll); - if (buffer.exists){ - view = get_first_view_with_buffer(app, buffer.buffer_id); - } - else{ - unlock_jump_buffer(); - } - } - - return(view); -} - -// -// Panel Management -// - -static View_ID special_note_view_id = 0; - -static bool32 default_use_scrollbars = false; -static bool32 default_use_file_bars = true; - -static void -new_view_settings(Application_Links *app, View_Summary *view){ - if (!default_use_scrollbars){ - view_set_setting(app, view, ViewSetting_ShowScrollbar, false); - } - if (!default_use_file_bars){ - view_set_setting(app, view, ViewSetting_ShowFileBar, false); - } -} - -static void -close_special_note_view(Application_Links *app){ - View_Summary special_view = get_view(app, special_note_view_id, AccessAll); - if (special_view.exists){ - close_view(app, &special_view); - } - special_note_view_id = 0; -} - -static View_Summary -open_special_note_view(Application_Links *app, bool32 create_if_not_exist = true){ - View_Summary special_view = get_view(app, special_note_view_id, AccessAll); - - if (create_if_not_exist && !special_view.exists){ - View_Summary view = get_active_view(app, AccessAll); - special_view = open_view(app, &view, ViewSplit_Bottom); - new_view_settings(app, &special_view); - view_set_split_proportion(app, &special_view, .2f); - set_active_view(app, &view); - special_note_view_id = special_view.view_id; - } - - return(special_view); -} - -CUSTOM_COMMAND_SIG(change_active_panel) -CUSTOM_DOC("Change the currently active panel, moving to the panel with the next highest view_id.") -{ - View_Summary view = get_active_view(app, AccessAll); - View_ID original_view_id = view.view_id; - - do{ - get_view_next_looped(app, &view, AccessAll); - if (view.view_id != special_note_view_id){ - break; - } - }while(view.view_id != original_view_id); - - if (view.exists){ - set_active_view(app, &view); - } -} - -CUSTOM_COMMAND_SIG(change_active_panel_backwards) -CUSTOM_DOC("Change the currently active panel, moving to the panel with the next lowest view_id.") -{ - View_Summary view = get_active_view(app, AccessAll); - View_ID original_view_id = view.view_id; - - do{ - get_view_prev_looped(app, &view, AccessAll); - if (view.view_id != special_note_view_id){ - break; - } - }while(view.view_id != original_view_id); - - if (view.exists){ - set_active_view(app, &view); - } -} - -CUSTOM_COMMAND_SIG(open_panel_vsplit) -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) -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); -} - -// -// View Variabls -// +//////////////////////////////// enum Rewrite_Type{ RewriteNone, @@ -192,65 +30,7 @@ struct View_Paste_Index{ int32_t index; }; -View_Paste_Index view_paste_index_[16]; -View_Paste_Index *view_paste_index = view_paste_index_ - 1; - - -// -// System Buffer Names -// - -static char out_buffer_space[1024]; -static char command_space[1024]; -static char hot_directory_space[1024]; - - -// -// Mouse Suppression -// - -static bool32 suppressing_mouse = false; - -static void -set_mouse_suppression(Application_Links *app, int32_t suppress){ - if (suppress){ - suppressing_mouse = 1; - show_mouse_cursor(app, MouseCursorShow_Never); - } - else{ - suppressing_mouse = 0; - show_mouse_cursor(app, MouseCursorShow_Always); - } -} - -CUSTOM_COMMAND_SIG(suppress_mouse) -CUSTOM_DOC("Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.") -{ - set_mouse_suppression(app, true); -} - -CUSTOM_COMMAND_SIG(allow_mouse) -CUSTOM_DOC("Shows the mouse and causes all mouse input to be processed normally.") -{ - set_mouse_suppression(app, false); -} - -CUSTOM_COMMAND_SIG(toggle_mouse) -CUSTOM_DOC("Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.") -{ - set_mouse_suppression(app, !suppressing_mouse); -} - -CUSTOM_COMMAND_SIG(toggle_fullscreen) -CUSTOM_DOC("Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.") -{ - set_fullscreen(app, !is_fullscreen(app)); -} - - -// -// Location Jumping State -// +//////////////////////////////// struct ID_Based_Jump_Location{ int32_t buffer_id; @@ -258,12 +38,7 @@ struct ID_Based_Jump_Location{ int32_t column; }; -static ID_Based_Jump_Location prev_location = {0}; - - -// -// Config File Parsing -// +//////////////////////////////// struct Config_Line{ Cpp_Token id_token; @@ -294,442 +69,14 @@ struct Config_Array_Reader{ bool32 good; }; -static Cpp_Token -read_config_token(Cpp_Token_Array array, int32_t *i_ptr){ - Cpp_Token token = {0}; - - int32_t i = *i_ptr; - - for (; i < array.count; ++i){ - Cpp_Token comment_token = array.tokens[i]; - if (comment_token.type != CPP_TOKEN_COMMENT){ - break; - } - } - - if (i < array.count){ - token = array.tokens[i]; - } - - *i_ptr = i; - - return(token); -} - -static Config_Line -read_config_line(Cpp_Token_Array array, int32_t *i_ptr, char *text){ - Config_Line config_line = {0}; - - int32_t i = *i_ptr; - - config_line.id_token = read_config_token(array, &i); - int32_t text_index_start = config_line.id_token.start; - if (config_line.id_token.type == CPP_TOKEN_IDENTIFIER){ - ++i; - if (i < array.count){ - Cpp_Token token = read_config_token(array, &i); - - bool32 lvalue_success = true; - if (token.type == CPP_TOKEN_BRACKET_OPEN){ - lvalue_success = false; - ++i; - if (i < array.count){ - config_line.subscript_token = read_config_token(array, &i); - if (config_line.subscript_token.type == CPP_TOKEN_INTEGER_CONSTANT){ - ++i; - if (i < array.count){ - token = read_config_token(array, &i); - if (token.type == CPP_TOKEN_BRACKET_CLOSE){ - ++i; - if (i < array.count){ - token = read_config_token(array, &i); - lvalue_success = true; - } - } - } - } - } - } - - if (lvalue_success){ - if (token.type == CPP_TOKEN_EQ){ - config_line.eq_token = read_config_token(array, &i); - ++i; - if (i < array.count){ - Cpp_Token val_token = read_config_token(array, &i); - - bool32 rvalue_success = true; - if (val_token.type == CPP_TOKEN_BRACE_OPEN){ - rvalue_success = false; - ++i; - if (i < array.count){ - config_line.val_array_start = i; - - bool32 expecting_array_item = 1; - for (; i < array.count; ++i){ - Cpp_Token array_token = read_config_token(array, &i); - if (array_token.size == 0){ - break; - } - if (array_token.type == CPP_TOKEN_BRACE_CLOSE){ - config_line.val_array_end = i; - rvalue_success = true; - break; - } - else{ - if (array_token.type == CPP_TOKEN_COMMA){ - if (!expecting_array_item){ - expecting_array_item = true; - } - else{ - break; - } - } - else{ - if (expecting_array_item){ - expecting_array_item = false; - ++config_line.val_array_count; - } - } - } - } - } - } - - if (rvalue_success){ - config_line.val_token = val_token; - ++i; - if (i < array.count){ - Cpp_Token semicolon_token = read_config_token(array, &i); - if (semicolon_token.type == CPP_TOKEN_SEMICOLON){ - config_line.read_success = true; - } - } - } - } - } - } - } - } - - if (!config_line.read_success){ - Cpp_Token token = {0}; - if (i < array.count){ - token = array.tokens[i]; - } - int32_t text_index_current = token.start + token.size; - if (text_index_current <= text_index_start){ - if (array.count > 0){ - token = array.tokens[array.count - 1]; - text_index_current = token.start + token.size; - } - } - - if (text_index_current > text_index_start){ - config_line.error_str = make_string(text + text_index_start, text_index_current - text_index_start); - } - - for (; i < array.count; ++i){ - Cpp_Token skip_token = read_config_token(array, &i); - if (skip_token.type == CPP_TOKEN_SEMICOLON){ - break; - } - } - } - - *i_ptr = i; - - return(config_line); -} - -static Config_Item -get_config_item(Config_Line line, char *mem, Cpp_Token_Array array){ - Config_Item item = {0}; - item.line = line; - item.array = array; - item.mem = mem; - if (line.id_token.size != 0){ - item.id = make_string(mem + line.id_token.start, line.id_token.size); - } - - if (line.subscript_token.size != 0){ - String subscript_str = make_string(mem + line.subscript_token.start,line.subscript_token.size); - item.subscript_index = str_to_int_s(subscript_str); - item.has_subscript = 1; - } - - return(item); -} - -static bool32 -config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_type, void *var_out){ - bool32 result = false; - bool32 subscript_success = true; - if (item.line.val_token.type == token_type){ - if ((var_name == 0 && item.id.size == 0) || match(item.id, var_name)){ - if (subscript){ - if (item.has_subscript){ - *subscript = item.subscript_index; - } - else{ - subscript_success = false; - } - } - - if (subscript_success){ - if (var_out){ - switch (token_type){ - case CPP_TOKEN_BOOLEAN_CONSTANT: - { - *(bool32*)var_out = (item.mem[item.line.val_token.start] == 't'); - }break; - - case CPP_TOKEN_INTEGER_CONSTANT: - { - if (match(make_string(item.mem + item.line.val_token.start, 2), "0x")){ - // Hex Integer - String val = make_string(item.mem + item.line.val_token.start + 2, item.line.val_token.size - 2); - *(uint32_t*)var_out = hexstr_to_int(val); - } - else{ - // Integer - String val = make_string(item.mem + item.line.val_token.start, item.line.val_token.size); - *(int32_t*)var_out = str_to_int(val); - } - }break; - - case CPP_TOKEN_STRING_CONSTANT: - { - String str = make_string(item.mem + item.line.val_token.start + 1,item.line.val_token.size - 2); - copy((String*)var_out, str); - }break; - - case CPP_TOKEN_IDENTIFIER: - { - String str = make_string(item.mem + item.line.val_token.start,item.line.val_token.size); - copy((String*)var_out, str); - }break; - - case CPP_TOKEN_BRACE_OPEN: - { - Config_Array_Reader *array_reader = (Config_Array_Reader*)var_out; - array_reader->array = item.array; - array_reader->mem = item.mem; - array_reader->i = item.line.val_array_start; - array_reader->val_array_end = item.line.val_array_end; - array_reader->good = 1; - }break; - } - } - result = true; - } - } - } - return(result); -} - -static bool32 -config_bool_var(Config_Item item, char *var_name, int32_t *subscript, bool32 *var_out){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BOOLEAN_CONSTANT, var_out); - return(result); -} - -static bool32 -config_int_var(Config_Item item, char *var_name, int32_t *subscript, int32_t *var_out){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out); - return(result); -} - -static bool32 -config_uint_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t *var_out){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out); - return(result); -} - -static bool32 -config_string_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_STRING_CONSTANT, var_out); - return(result); -} - -static bool32 -config_identifier_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_IDENTIFIER, var_out); - return(result); -} - -static bool32 -config_array_var(Config_Item item, char *var_name, int32_t *subscript, Config_Array_Reader *array_reader){ - bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BRACE_OPEN, array_reader); - return(result); -} - -static bool32 -config_array_next_item(Config_Array_Reader *array_reader, Config_Item *item){ - bool32 result = false; - - for (;array_reader->i < array_reader->val_array_end; - ++array_reader->i){ - Cpp_Token array_token = read_config_token(array_reader->array, &array_reader->i); - if (array_token.size == 0 || array_reader->i >= array_reader->val_array_end){ - break; - } - - if (array_token.type == CPP_TOKEN_BRACE_CLOSE){ - break; - } - - switch (array_token.type){ - case CPP_TOKEN_BOOLEAN_CONSTANT: - case CPP_TOKEN_INTEGER_CONSTANT: - case CPP_TOKEN_STRING_CONSTANT: - { - Config_Line line = {0}; - line.val_token = array_token; - line.read_success = 1; - *item = get_config_item(line, array_reader->mem, array_reader->array); - result = true; - ++array_reader->i; - goto doublebreak; - }break; - } - } - doublebreak:; - - array_reader->good = result; - return(result); -} - -static bool32 -config_array_good(Config_Array_Reader *array_reader){ - bool32 result = (array_reader->good); - return(result); -} - - -// -// Lexer Helper -// - -static void -lexer_keywords_default_init(Partition *part, Cpp_Keyword_Table *kw_out, Cpp_Keyword_Table *pp_out){ - umem_4tech kw_size = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS); - umem_4tech pp_size = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES); - - void *kw_mem = push_block(part, (i32_4tech)kw_size); - void *pp_mem = push_block(part, (i32_4tech)pp_size); - - *kw_out = cpp_make_table_default(CPP_TABLE_KEYWORDS, kw_mem, kw_size); - *pp_out = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, pp_mem, pp_size); -} - - -// -// Dynamic Mapping Changes -// +//////////////////////////////// struct Named_Mapping{ String name; Custom_Command_Function *remap_command; }; -static Named_Mapping *named_maps = 0; -static int32_t named_map_count = 0; - -static void -change_mapping(Application_Links *app, String mapping){ - bool32 did_remap = false; - for (int32_t i = 0; i < named_map_count; ++i){ - if (match(mapping, named_maps[i].name)){ - did_remap = true; - exec_command(app, named_maps[i].remap_command); - break; - } - } - if (!did_remap){ - print_message(app, literal("Leaving bindings unaltered.\n")); - } -} - -CUSTOM_COMMAND_SIG(remap_interactive) -CUSTOM_DOC("Switch to a named key binding map.") -{ - Query_Bar bar = {0}; - char space[1024]; - bar.prompt = make_lit_string("Map Name: "); - bar.string = make_fixed_width_string(space); - - if (!query_user_string(app, &bar)) return; - - change_mapping(app, bar.string); -} - - -// -// Configuration -// - -static bool32 enable_code_wrapping = true; - -static bool32 automatically_adjust_wrapping = true; -static bool32 automatically_indent_text_on_save = true; -static bool32 automatically_save_changes_on_build = true; - -static int32_t default_wrap_width = 672; -static int32_t default_min_base_width = 550; - -static char default_theme_name_space[256] = {0}; -static String default_theme_name = make_fixed_width_string(default_theme_name_space); - -static char default_font_name_space[256] = {0}; -static String default_font_name = make_fixed_width_string(default_font_name_space); - -static char user_name_space[256] = {0}; -static String user_name = make_fixed_width_string(user_name_space); - -static bool32 automatically_load_project = false; - -static char default_compiler_bat_space[256]; -static String default_compiler_bat = make_fixed_width_string(default_compiler_bat_space); - -static char default_flags_bat_space[1024]; -static String default_flags_bat = make_fixed_width_string(default_flags_bat_space); - -static char default_compiler_sh_space[256]; -static String default_compiler_sh = make_fixed_width_string(default_compiler_sh_space); - -static char default_flags_sh_space[1024]; -static String default_flags_sh = make_fixed_width_string(default_flags_sh_space); - -static bool32 -get_current_name(char **name_out, int32_t *len_out){ - bool32 result = false; - *name_out = 0; - if (user_name.str[0] != 0){ - *name_out = user_name.str; - *len_out = user_name.size; - result = true; - } - return(result); -} - -static String -get_default_theme_name(void){ - String str = default_theme_name; - if (str.size == 0){ - str = make_lit_string("4coder"); - } - return(str); -} - -static String -get_default_font_name(void){ - String str = default_font_name; - if (str.size == 0){ - str = make_lit_string("Liberation Mono"); - } - return(str); -} +//////////////////////////////// struct Extension_List{ char space[256]; @@ -742,683 +89,6 @@ struct CString_Array{ int32_t count; }; -static char *default_extensions[] = { - "cpp", - "hpp", - "c", - "h", - "cc", - "cs", -}; - -static Extension_List treat_as_code_exts = {0}; - -static CString_Array -get_code_extensions(Extension_List *list){ - CString_Array array = {0}; - array.strings = default_extensions; - array.count = ArrayCount(default_extensions); - if (list->count != 0){ - array.strings = list->exts; - array.count = list->count; - } - return(array); -} - -static void -parse_extension_line_to_extension_list(String str, Extension_List *list){ - int32_t mode = 0; - int32_t j = 0, k = 0; - for (int32_t i = 0; i < str.size; ++i){ - switch (mode){ - case 0: - { - if (str.str[i] == '.'){ - mode = 1; - list->exts[k++] = &list->space[j]; - } - }break; - - case 1: - { - if (str.str[i] == '.'){ - list->space[j++] = 0; - list->exts[k++] = &list->space[j]; - } - else{ - list->space[j++] = str.str[i]; - } - }break; - } - } - list->space[j++] = 0; - list->count = k; -} - -// TODO(allen): Stop handling files this way! My own API should be able to do this!!?!?!?!!?!?!!!!? -// NOTE(allen): Actually need binary buffers for some stuff to work, but not this parsing thing here. -#include - -static String -dump_file_handle(Partition *arena, FILE *file){ - String str = {0}; - if (file != 0){ - fseek(file, 0, SEEK_END); - int32_t size = ftell(file); - char *mem = push_array(arena, char, size + 1); - push_align(arena, 8); - if (mem != 0){ - fseek(file, 0, SEEK_SET); - fread(mem, 1, size, file); - mem[size] = 0; - str = make_string_cap(mem, size, size + 1); - } - } - return(str); -} - -static FILE* -open_file_search_up_path(Partition *scratch, String path, String file_name){ - Temp_Memory temp = begin_temp_memory(scratch); - - int32_t cap = path.size + file_name.size + 2; - char *space = push_array(scratch, char, cap); - String name_str = make_string_cap(space, 0, cap); - append(&name_str, path); - if (name_str.size == 0 || !char_is_slash(name_str.str[name_str.size - 1])){ - append(&name_str, "/"); - } - - FILE *file = 0; - for (;;){ - int32_t base_size = name_str.size; - append(&name_str, file_name); - terminate_with_null(&name_str); - file = fopen(name_str.str, "rb"); - if (file != 0){ - break; - } - - name_str.size = base_size; - remove_last_folder(&name_str); - if (name_str.size >= base_size){ - break; - } - } - - end_temp_memory(temp); - return(file); -} - -static char* -get_null_terminated(Partition *scratch, String name){ - char *name_terminated = 0; - if (name.size < name.memory_size){ - terminate_with_null(&name); - name_terminated = name.str; - } - else{ - name_terminated = push_array(scratch, char, name.size + 1); - if (name_terminated != 0){ - memcpy(name_terminated, name.str, name.size); - name_terminated[name.size] = 0; - } - } - return(name_terminated); -} - -static FILE* -open_file(Partition *scratch, String name){ - FILE *file = 0; - Temp_Memory temp = begin_temp_memory(scratch); - char *name_terminated = get_null_terminated(scratch, name); - if (name_terminated != 0){ - file = fopen(name_terminated, "rb"); - } - end_temp_memory(temp); - return(file); -} - -static String -dump_file(Partition *arena, String name){ - String result = {0}; - FILE *file = open_file(arena, name); - if (file != 0){ - result = dump_file_handle(arena, file); - fclose(file); - } - return(result); -} - -static String -dump_file_search_up_path(Partition *arena, String path, String file_name){ - String result = {0}; - FILE *file = open_file_search_up_path(arena, path, file_name); - if (file != 0){ - result = dump_file_handle(arena, file); - fclose(file); - } - return(result); -} - -/////////////////////////////// - -static void -process_config_data(Application_Links *app, Partition *scratch, String data){ - - Cpp_Token_Array array = {0}; - array.count = 0; - array.max_count = (1 << 20)/sizeof(Cpp_Token); - array.tokens = push_array(scratch, Cpp_Token, array.max_count); - - if (array.tokens != 0){ - Cpp_Keyword_Table kw_table = {0}; - Cpp_Keyword_Table pp_table = {0}; - lexer_keywords_default_init(scratch, &kw_table, &pp_table); - - Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); - Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); - - if (result == LexResult_Finished){ - int32_t new_wrap_width = default_wrap_width; - int32_t new_min_base_width = default_min_base_width; - bool32 lalt_lctrl_is_altgr = false; - - for (int32_t i = 0; i < array.count; ++i){ - Config_Line config_line = read_config_line(array, &i, data.str); - - if (config_line.read_success){ - Config_Item item = get_config_item(config_line, data.str, array); - - config_bool_var(item, "enable_code_wrapping", 0, &enable_code_wrapping); - config_bool_var(item, "automatically_adjust_wrapping", 0, &automatically_adjust_wrapping); - config_bool_var(item, "automatically_indent_text_on_save", 0, &automatically_indent_text_on_save); - config_bool_var(item, "automatically_save_changes_on_build", 0, &automatically_save_changes_on_build); - - config_int_var(item, "default_wrap_width", 0, &new_wrap_width); - config_int_var(item, "default_min_base_width", 0, &new_min_base_width); - - config_string_var(item, "default_theme_name", 0, &default_theme_name); - config_string_var(item, "default_font_name", 0, &default_font_name); - config_string_var(item, "user_name", 0, &user_name); - - config_string_var(item, "default_compiler_bat", 0, &default_compiler_bat); - config_string_var(item, "default_flags_bat", 0, &default_flags_bat); - config_string_var(item, "default_compiler_sh", 0, &default_compiler_sh); - config_string_var(item, "default_flags_sh", 0, &default_flags_sh); - - char str_space[512]; - String str = make_fixed_width_string(str_space); - if (config_string_var(item, "mapping", 0, &str)){ - change_mapping(app, str); - } - - if (config_string_var(item, "treat_as_code", 0, &str)){ - parse_extension_line_to_extension_list(str, &treat_as_code_exts); - } - - config_bool_var(item, "automatically_load_project", 0, &automatically_load_project); - - config_bool_var(item, "lalt_lctrl_is_altgr", 0, &lalt_lctrl_is_altgr); - } - else if (config_line.error_str.str != 0){ - char space[2048]; - String str = make_fixed_width_string(space); - copy(&str, "WARNING: bad syntax in 4coder.config at "); - append(&str, config_line.error_str); - append(&str, "\n"); - print_message(app, str.str, str.size); - } - } - - adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width); - default_wrap_width = new_wrap_width; - default_min_base_width = new_min_base_width; - global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, lalt_lctrl_is_altgr); - } - } - else{ - print_message(app, literal("Ran out of memory processing config.4coder\n")); - } -} - -static void -process_config_file(Application_Links *app){ - static bool32 has_initialized = false; - if (!has_initialized){ - has_initialized = true; - copy(&default_compiler_bat, "cl"); - copy(&default_flags_bat, ""); - copy(&default_compiler_sh, "g++"); - copy(&default_flags_bat, ""); - } - - Partition *part = &global_part; - FILE *file = fopen("config.4coder", "rb"); - - if (file == 0){ - char space[256]; - int32_t size = get_4ed_path(app, space, sizeof(space)); - print_message(app, space, size); - String str = make_string_cap(space, size, sizeof(space)); - append_sc(&str, "/config.4coder"); - terminate_with_null(&str); - file = fopen(str.str, "rb"); - } - - if (file != 0){ - Temp_Memory temp = begin_temp_memory(part); - String data = dump_file_handle(part, file); - if (data.str != 0){ - process_config_data(app, part, data); - } - end_temp_memory(temp); - fclose(file); - } - else{ - print_message(app, literal("Did not find config.4coder, using default settings\n")); - } -} - -// -// Color Theme -// - -static bool32 -load_color_theme_data(Application_Links *app, Partition *scratch, - char *file_name, String data){ - bool32 success = false; - - Cpp_Token_Array array; - array.count = 0; - array.max_count = (1 << 20)/sizeof(Cpp_Token); - array.tokens = push_array(scratch, Cpp_Token, array.max_count); - - Cpp_Keyword_Table kw_table = {0}; - Cpp_Keyword_Table pp_table = {0}; - lexer_keywords_default_init(scratch, &kw_table, &pp_table); - - Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); - Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); - - if (result == LexResult_Finished){ - success = true; - - char name_space[512]; - String name_str = make_fixed_width_string(name_space); - Theme theme; - init_theme_zero(&theme); - - for (int32_t i = 0; i < array.count; ++i){ - Config_Line config_line = read_config_line(array, &i, data.str); - if (config_line.read_success){ - Config_Item item = get_config_item(config_line, data.str, array); - config_string_var(item, "name", 0, &name_str); - - for (int32_t tag = 0; tag < ArrayCount(style_tag_names); ++tag){ - char *name = style_tag_names[tag]; - int_color color = 0; - if (config_uint_var(item, name, 0, &color)){ - int_color *color_slot = &theme.colors[tag]; - *color_slot = color; - } - else{ - char var_space[512]; - String var_str = make_fixed_width_string(var_space); - if (config_identifier_var(item, name, 0, &var_str)){ - for (int32_t eq_tag = 0; eq_tag < ArrayCount(style_tag_names); ++eq_tag){ - if (match(var_str, style_tag_names[eq_tag])){ - int_color *color_slot = &theme.colors[tag]; - *color_slot = theme.colors[eq_tag]; - break; - } - } - } - } - } - } - else if (config_line.error_str.str != 0){ - char space[2048]; - String str = make_fixed_width_string(space); - copy(&str, "WARNING: bad syntax in 4coder.config at "); - append(&str, config_line.error_str); - append(&str, "\n"); - print_message(app, str.str, str.size); - } - } - - if (name_str.size == 0){ - copy(&name_str, file_name); - } - - create_theme(app, &theme, name_str.str, name_str.size); - } - - return(success); -} - -static void -load_color_theme_file(Application_Links *app, char *file_name){ - Partition *part = &global_part; - FILE *file = fopen(file_name, "rb"); - - if (file == 0){ - char space[256]; - int32_t size = get_4ed_path(app, space, sizeof(space)); - String str = make_string_cap(space, size, sizeof(space)); - append_sc(&str, "/"); - append_sc(&str, file_name); - terminate_with_null(&str); - file = fopen(str.str, "rb"); - } - - if (file != 0){ - Temp_Memory temp = begin_temp_memory(part); - String data = dump_file_handle(part, file); - bool32 success = false; - if (data.str != 0){ - success = load_color_theme_data(app, part, file_name, data); - } - end_temp_memory(temp); - fclose(file); - - if (!success){ - char space[256]; - String str = make_fixed_width_string(space); - append_sc(&str, "Could not parse "); - append_sc(&str, file_name); - append_sc(&str, ", color scheme not loaded"); - print_message(app, str.str, str.size); - } - } - else{ - char space[256]; - String str = make_fixed_width_string(space); - append_sc(&str, "Did not find "); - append_sc(&str, file_name); - append_sc(&str, ", color scheme not loaded"); - print_message(app, str.str, str.size); - } -} - -static void -load_themes_folder(Application_Links *app){ - char folder_name_space[512]; - String folder_name = make_fixed_width_string(folder_name_space); - folder_name.size = get_4ed_path(app, folder_name_space, sizeof(folder_name_space)); - append(&folder_name, "themes"); - - if (folder_name.size < folder_name.memory_size){ - File_List list = get_file_list(app, folder_name.str, folder_name.size); - for (uint32_t i = 0; i < list.count; ++i){ - File_Info *info = &list.infos[i]; - if (!info->folder){ - char file_name_space[512]; - String file_name = make_fixed_width_string(file_name_space); - copy(&file_name, folder_name); - append(&file_name, "/"); - append(&file_name, make_string(info->filename, info->filename_len)); - if (file_name.size < file_name.memory_size){ - terminate_with_null(&file_name); - load_color_theme_file(app, file_name.str); - } - } - } - free_file_list(app, list); - } -} - -// -// Font Helpers -// - -static bool32 -descriptions_match(Face_Description *a, Face_Description *b){ - bool32 result = false; - if (match(a->font.name, b->font.name) && a->font.in_local_font_folder == b->font.in_local_font_folder){ - if (memcmp((&a->pt_size), (&b->pt_size), sizeof(*a) - sizeof(a->font)) == 0){ - result = true; - } - } - return(result); -} - -static Face_ID -get_existing_face_id_matching_name(Application_Links *app, char *name, int32_t len){ - String name_str = make_string(name, len); - Face_ID largest_id = get_largest_face_id(app); - Face_ID result = 0; - for (Face_ID id = 1; id <= largest_id; ++id){ - Face_Description compare = get_face_description(app, id); - if (match(compare.font.name, name_str)){ - result = id; - break; - } - } - return(result); -} - -static Face_ID -get_existing_face_id_matching_description(Application_Links *app, Face_Description *description){ - Face_ID largest_id = get_largest_face_id(app); - Face_ID result = 0; - for (Face_ID id = 1; id <= largest_id; ++id){ - Face_Description compare = get_face_description(app, id); - if (descriptions_match(&compare, description)){ - result = id; - break; - } - } - return(result); -} - -static Face_ID -get_face_id_by_name(Application_Links *app, char *name, int32_t len, Face_Description *base_description){ - Face_ID new_id = 0; - - String str = make_string(name, len); - if (!match(str, base_description->font.name)){ - new_id = get_existing_face_id_matching_name(app, name, len); - if (new_id == 0){ - Face_Description description = *base_description; - copy_fast_unsafe_cs(description.font.name, str); - description.font.name[str.size] = 0; - - description.font.in_local_font_folder = false; - new_id = try_create_new_face(app, &description); - if (new_id == 0){ - description.font.in_local_font_folder = true; - new_id = try_create_new_face(app, &description); - } - } - } - - return(new_id); -} - -static void -change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_buffers){ - Face_ID global_face_id = get_face_id(app, 0); - Face_Description description = get_face_description(app, global_face_id); - Face_ID new_id = get_face_id_by_name(app, name, len, &description); - if (new_id != 0){ - set_global_face(app, new_id, apply_to_all_buffers); - } -} - -static void -buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){ - Face_ID current_id = get_face_id(app, buffer); - if (current_id != 0){ - Face_Description description = get_face_description(app, current_id); - Face_ID new_id = get_face_id_by_name(app, name, len, &description); - if (new_id != 0){ - buffer_set_face(app, buffer, new_id); - } - } -} - -static Face_ID -get_face_id_by_description(Application_Links *app, Face_Description *description, Face_Description *base_description){ - Face_ID new_id = 0; - - if (!descriptions_match(description, base_description)){ - new_id = get_existing_face_id_matching_description(app, description); - if (new_id == 0){ - new_id = try_create_new_face(app, description); - } - } - - return(new_id); -} - -static void -change_face_description(Application_Links *app, Face_Description *new_description, bool32 apply_to_all_buffers){ - Face_ID global_face_id = get_face_id(app, 0); - Face_Description old_description = get_face_description(app, global_face_id); - Face_ID new_id = get_face_id_by_description(app, new_description, &old_description); - if (new_id != 0){ - set_global_face(app, new_id, apply_to_all_buffers); - } -} - -static void -buffer_set_face_description(Application_Links *app, Buffer_Summary *buffer, Face_Description *new_description){ - Face_ID current_id = get_face_id(app, buffer); - if (current_id != 0){ - Face_Description old_description = get_face_description(app, current_id); - Face_ID new_id = get_face_id_by_description(app, new_description, &old_description); - if (new_id != 0){ - buffer_set_face(app, buffer, new_id); - } - } -} - -static Face_Description -get_buffer_face_description(Application_Links *app, Buffer_Summary *buffer){ - Face_ID current_id = get_face_id(app, buffer); - Face_Description description = {0}; - if (current_id != 0){ - description = get_face_description(app, current_id); - } - return(description); -} - -static Face_Description -get_global_face_description(Application_Links *app){ - Face_ID current_id = get_face_id(app, 0); - Face_Description description = get_face_description(app, current_id); - return(description); -} - -// -// Framework Init Functions -// - -static void -init_memory(Application_Links *app){ - int32_t part_size = (32 << 20); - int32_t general_size = (4 << 20); - - void *part_mem = memory_allocate(app, part_size); - global_part = make_part(part_mem, part_size); - - void *general_mem = memory_allocate(app, general_size); - general_memory_open(&global_general, general_mem, general_size); -} - -static void -default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){ - init_memory(app); - process_config_file(app); - load_themes_folder(app); - - String theme = get_default_theme_name(); - String font = get_default_font_name(); - - change_theme(app, theme.str, theme.size); - change_font(app, font.str, font.size, true); - - default_use_scrollbars = use_scrollbars; - default_use_file_bars = use_file_bars; -} - -static void -default_4coder_initialize(Application_Links *app){ - default_4coder_initialize(app, false, true); -} - -static void -default_4coder_side_by_side_panels(Application_Links *app, Buffer_Identifier left_buffer, Buffer_Identifier right_buffer){ - Buffer_ID left_id = buffer_identifier_to_id(app, left_buffer); - Buffer_ID right_id = buffer_identifier_to_id(app, right_buffer); - - // Left Panel - View_Summary view = get_active_view(app, AccessAll); - new_view_settings(app, &view); - view_set_buffer(app, &view, left_id, 0); - - // Right Panel - open_panel_vsplit(app); - View_Summary right_view = get_active_view(app, AccessAll); - view_set_buffer(app, &right_view, right_id, 0); - - // Restore Active to Left - set_active_view(app, &view); -} - -static void -default_4coder_side_by_side_panels(Application_Links *app, char **command_line_files, int32_t file_count){ - Buffer_Identifier left = buffer_identifier(literal("*scratch*")); - Buffer_Identifier right = buffer_identifier(literal("*messages*")); - - if (file_count > 0){ - char *left_name = command_line_files[0]; - int32_t left_len = str_size(left_name); - left = buffer_identifier(left_name, left_len); - - if (file_count > 1){ - char *right_name = command_line_files[1]; - int32_t right_len = str_size(right_name); - right = buffer_identifier(right_name, right_len); - } - } - - default_4coder_side_by_side_panels(app, left, right); -} - -static void -default_4coder_side_by_side_panels(Application_Links *app){ - default_4coder_side_by_side_panels(app, 0, 0); -} - -static void -default_4coder_one_panel(Application_Links *app, Buffer_Identifier buffer){ - Buffer_ID id = buffer_identifier_to_id(app, buffer); - - View_Summary view = get_active_view(app, AccessAll); - new_view_settings(app, &view); - view_set_buffer(app, &view, id, 0); -} - -static void -default_4coder_one_panel(Application_Links *app, char **command_line_files, int32_t file_count){ - Buffer_Identifier buffer = buffer_identifier(literal("*messages*")); - - if (file_count > 0){ - char *name = command_line_files[0]; - int32_t len = str_size(name); - buffer = buffer_identifier(name, len); - } - - default_4coder_one_panel(app, buffer); -} - -static void -default_4coder_one_panel(Application_Links *app){ - default_4coder_one_panel(app, 0, 0); -} - #endif // BOTTOM diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 7a9de1d1..ec104974 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -1,7 +1,5 @@ /* 4coder_default_hooks.cpp - Sets up the hooks for the default framework. - -TYPE: 'internal-for-default-system' */ // TOP @@ -9,9 +7,7 @@ TYPE: 'internal-for-default-system' #if !defined(FCODER_DEFAULT_HOOKS_CPP) #define FCODER_DEFAULT_HOOKS_CPP -#include "4coder_default_framework.h" #include "4coder_helper/4coder_bind_helper.h" -#include "4coder_project_commands.cpp" #include "languages/4coder_language_cpp.h" #include "languages/4coder_language_rust.h" diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index e414fe6c..5d77afb3 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -1,7 +1,5 @@ /* 4coder_default_include.cpp - Default set of commands and setup used in 4coder. - -TYPE: 'major-system-include' */ // TOP @@ -10,13 +8,28 @@ TYPE: 'major-system-include' #define FCODER_DEFAULT_INCLUDE_CPP #include "4coder_API/custom.h" - #include "4coder_os_comp_cracking.h" +#include "4coder_helper/4coder_helper.h" +#include "4coder_helper/4coder_streaming.h" +#include "4coder_helper/4coder_long_seek.h" +#include "4coder_lib/4coder_mem.h" +#include "4coder_lib/4coder_utf8.h" + #include "4coder_default_framework.h" +#include "4coder_auto_indent.h" +#include "4coder_build_commands.h" +#include "4coder_jumping.h" +#include "4coder_jump_sticky.h" +#include "4coder_project_commands.h" +#include "4coder_function_list.h" +#include "4coder_scope_commands.h" + #include "4coder_base_commands.cpp" +#include "4coder_default_framework.cpp" #include "4coder_auto_indent.cpp" #include "4coder_search.cpp" +#include "4coder_jumping.cpp" #include "4coder_jump_direct.cpp" #include "4coder_jump_sticky.cpp" #include "4coder_clipboard.cpp" diff --git a/4coder_file.h b/4coder_file.h index 4d48eb03..1b5b622a 100644 --- a/4coder_file.h +++ b/4coder_file.h @@ -1,8 +1,6 @@ /* 4coder_file.h - File enumeration and reading procedures for each platform. - -TYPE: 'utility' -*/ + */ // TOP diff --git a/4coder_function_list.cpp b/4coder_function_list.cpp index e8eacc19..06e3f22b 100644 --- a/4coder_function_list.cpp +++ b/4coder_function_list.cpp @@ -1,23 +1,9 @@ /* 4coder_function_list.cpp - Command for listing all functions in a C/C++ file in a jump list. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_FUNCTION_LIST_CPP) -#define FCODER_FUNCTION_LIST_CPP - -#include "4coder_API/custom.h" - -#include "4coder_default_framework.h" - -#include "4coder_helper/4coder_helper.h" -#include "4coder_helper/4coder_streaming.h" - -#include "4coder_lib/4coder_mem.h" - // NOTE(allen|a4.0.14): This turned out to be a nasty little routine. There might // be a better way to do it with just tokens that I didn't see the first time // through. Once I build a real parser this should become almost just as easy as @@ -27,22 +13,6 @@ TYPE: 'drop-in-command-pack' // will then provide the "list_all_functions_current_buffer" command. // -// -// Declaration list -// - -struct Function_Positions{ - int32_t sig_start_index; - int32_t sig_end_index; - int32_t open_paren_pos; -}; - -struct Get_Positions_Results{ - int32_t positions_count; - int32_t next_token_index; - bool32 still_looping; -}; - static Get_Positions_Results get_function_positions(Application_Links *app, Buffer_Summary *buffer, int32_t token_index, Function_Positions *positions_array, int32_t positions_max){ Get_Positions_Results result = {0}; @@ -354,7 +324,5 @@ CUSTOM_DOC("Creates a jump list of lines of the current buffer that appear to de list_all_functions(app, &global_part, &buffer); } -#endif - // BOTTOM diff --git a/4coder_function_list.h b/4coder_function_list.h new file mode 100644 index 00000000..7d9db9cd --- /dev/null +++ b/4coder_function_list.h @@ -0,0 +1,25 @@ +/* +4coder_function_list.cpp - Command for listing all functions in a C/C++ file in a jump list. +*/ + +// TOP + +#if !defined(FCODER_FUNCTION_LIST_H) +#define FCODER_FUNCTION_LIST_H + +struct Function_Positions{ + int32_t sig_start_index; + int32_t sig_end_index; + int32_t open_paren_pos; +}; + +struct Get_Positions_Results{ + int32_t positions_count; + int32_t next_token_index; + bool32 still_looping; +}; + +#endif + +// BOTTOM + diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 25f51a98..e1adac29 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -214,200 +214,200 @@ int32_t source_name_len; int32_t line_number; }; static Command_Metadata fcoder_metacmd_table[194] = { -{ 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, 748 }, -{ 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, 759 }, -{ 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, 738 }, -{ 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, 543 }, -{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 203 }, -{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 169 }, -{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 136 }, -{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 125 }, -{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 143 }, -{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 225 }, -{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 475 }, -{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 190 }, -{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 203 }, -{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 150 }, -{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 219 }, -{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 551 }, -{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 52 }, -{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 109 }, -{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 61 }, -{ 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, 644 }, -{ 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, 621 }, -{ 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, 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, 1091 }, -{ 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, 391 }, -{ 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, 369 }, -{ 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, 674 }, -{ 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, 682 }, -{ 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, 783 }, -{ 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, 690 }, -{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 416 }, -{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 423 }, -{ 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, 586 }, -{ 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, 568 }, -{ 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 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 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.", 167, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 412 }, -{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 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_sticky.cpp", 43, 384 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 700 }, -{ PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 64 }, -{ PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 82 }, -{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 537 }, -{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 507 }, -{ PROC_LINKS(goto_prev_jump_direct, 0), "goto_prev_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 73 }, -{ PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 91 }, -{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 553 }, -{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 523 }, -{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 584 }, -{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 570 }, -{ 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, 570 }, -{ 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, 632 }, -{ 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, 610 }, -{ 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, 1270 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1246 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1252 }, -{ 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, 1258 }, -{ 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, 1264 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1288 }, -{ 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, 702 }, -{ 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, 722 }, -{ 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, 786 }, -{ 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, 792 }, -{ 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, 834 }, -{ 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, 840 }, -{ 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, 485 }, -{ 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, 497 }, -{ 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, 712 }, -{ 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, 732 }, -{ 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, 439 }, -{ 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, 1199 }, -{ 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 }, -{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 103 }, -{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment 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, 386 }, -{ 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, 248 }, -{ 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, 260 }, -{ 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, 335 }, -{ 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, 301 }, -{ 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, 346 }, -{ 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, 310 }, -{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 242 }, -{ 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, 254 }, -{ 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, 624 }, -{ 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, 609 }, -{ 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, 157 }, -{ 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, 164 }, -{ 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, 1294 }, -{ 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, 667 }, -{ 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, 684 }, -{ 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, 546 }, -{ 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, 562 }, -{ 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, 554 }, -{ 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, 740 }, -{ 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, 291 }, -{ 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, 282 }, -{ 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, 422 }, -{ 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, 429 }, -{ 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, 510 }, -{ 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, 535 }, -{ 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, 1012 }, -{ 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, 1033 }, -{ 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, 1240 }, -{ 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, 478 }, -{ 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, 654 }, -{ 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, 1157 }, -{ 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, 1276 }, -{ 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, 909 }, -{ 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, 880 }, -{ 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, 898 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1282 }, -{ 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, 1056 }, -{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.", 105, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1117 }, -{ 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, 873 }, -{ 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, 887 }, -{ 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 }, -{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 136 }, -{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 132 }, -{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 124 }, -{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 376 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 354 }, -{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 389 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 365 }, -{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 112 }, -{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 108 }, -{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 120 }, -{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 116 }, -{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 343 }, -{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 409 }, -{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 104 }, -{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 100 }, -{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 332 }, -{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 402 }, -{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 319 }, -{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 49 }, -{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 63 }, -{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 77 }, -{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 100 }, -{ 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, 582 }, -{ 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, 577 }, -{ 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, 563 }, -{ 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, 764 }, -{ 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, 455 }, -{ 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, 435 }, -{ 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, 591 }, -{ 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, 600 }, -{ 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, 667 }, -{ 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, 656 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1234 }, -{ 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, 754 }, -{ 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, 863 }, -{ 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, 771 }, -{ 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, 617 }, -{ 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_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, 605 }, -{ 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, 611 }, -{ 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, 599 }, -{ 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, 623 }, +{ 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.cpp", 49, 221 }, +{ 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, 722 }, +{ 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, 733 }, +{ 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, 712 }, +{ 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, 71 }, +{ 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, 160 }, +{ 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, 533 }, +{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 188 }, +{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 154 }, +{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 126 }, +{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 147 }, +{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 165 }, +{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 210 }, +{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 465 }, +{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 180 }, +{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 193 }, +{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 401 }, +{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 204 }, +{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 541 }, +{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 43 }, +{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 99 }, +{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 52 }, +{ 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, 634 }, +{ 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, 611 }, +{ 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, 53 }, +{ 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, 487 }, +{ 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, 1081 }, +{ 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, 404 }, +{ 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, 111 }, +{ 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, 180 }, +{ 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, 382 }, +{ 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, 664 }, +{ 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, 672 }, +{ 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, 23 }, +{ 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, 796 }, +{ 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, 7 }, +{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 680 }, +{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 406 }, +{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 413 }, +{ 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, 84 }, +{ 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, 533 }, +{ 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, 515 }, +{ 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, 8 }, +{ 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, 29 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 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.", 167, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 365 }, +{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 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_sticky.cpp", 43, 337 }, +{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 690 }, +{ PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 48 }, +{ PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 66 }, +{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 484 }, +{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 454 }, +{ PROC_LINKS(goto_prev_jump_direct, 0), "goto_prev_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 57 }, +{ PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 75 }, +{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 500 }, +{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 470 }, +{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 574 }, +{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 560 }, +{ 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, 363 }, +{ PROC_LINKS(highlight_prev_scope_absolute, 0), "highlight_prev_scope_absolute", 29, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 382 }, +{ PROC_LINKS(highlight_surrounding_scope, 0), "highlight_surrounding_scope", 27, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 341 }, +{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 583 }, +{ 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, 622 }, +{ 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, 600 }, +{ 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, 1260 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1236 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1242 }, +{ 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, 1248 }, +{ 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, 1254 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1278 }, +{ 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, 29 }, +{ 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, 141 }, +{ 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, 318 }, +{ 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, 498 }, +{ 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, 510 }, +{ 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, 424 }, +{ 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, 1189 }, +{ 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, 117 }, +{ 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, 390 }, +{ 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, 402 }, +{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 101 }, +{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment 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, 384 }, +{ 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, 396 }, +{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 238 }, +{ 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, 250 }, +{ 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, 348 }, +{ 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, 291 }, +{ 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, 359 }, +{ 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, 284 }, +{ 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, 300 }, +{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 232 }, +{ 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, 244 }, +{ 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, 120 }, +{ 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, 101 }, +{ 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, 116 }, +{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 571 }, +{ 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, 556 }, +{ 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, 408 }, +{ 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, 415 }, +{ 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, 1284 }, +{ 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, 680 }, +{ 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, 697 }, +{ 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, 559 }, +{ 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, 575 }, +{ 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, 567 }, +{ 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, 753 }, +{ 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.cpp", 49, 192 }, +{ 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.cpp", 49, 183 }, +{ 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, 281 }, +{ 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, 272 }, +{ 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, 61 }, +{ 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, 435 }, +{ 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, 99 }, +{ 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, 442 }, +{ 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, 481 }, +{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 495 }, +{ 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, 520 }, +{ 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, 1002 }, +{ 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, 1023 }, +{ 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, 253 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1230 }, +{ 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, 463 }, +{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 578 }, +{ 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, 1147 }, +{ 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, 385 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1266 }, +{ 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, 771 }, +{ 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, 899 }, +{ 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, 870 }, +{ 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, 888 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1272 }, +{ 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, 1046 }, +{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.", 105, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1107 }, +{ 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, 738 }, +{ 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, 863 }, +{ 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, 877 }, +{ 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, 141 }, +{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 149 }, +{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 145 }, +{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 137 }, +{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 366 }, +{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 344 }, +{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 379 }, +{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 355 }, +{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 125 }, +{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 121 }, +{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 133 }, +{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 129 }, +{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 333 }, +{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 399 }, +{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 117 }, +{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 113 }, +{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 322 }, +{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 392 }, +{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 309 }, +{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 47 }, +{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 61 }, +{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 75 }, +{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 90 }, +{ 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, 567 }, +{ 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, 567 }, +{ 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, 553 }, +{ 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, 200 }, +{ 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, 224 }, +{ 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.cpp", 49, 215 }, +{ 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, 777 }, +{ 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, 445 }, +{ 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, 425 }, +{ 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, 581 }, +{ 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.cpp", 49, 233 }, +{ 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, 590 }, +{ 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.cpp", 49, 227 }, +{ 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, 657 }, +{ 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, 646 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1224 }, +{ 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, 767 }, +{ 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, 745 }, +{ 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, 630 }, +{ 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, 37 }, +{ 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, 707 }, +{ 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, 701 }, +{ 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, 618 }, +{ 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, 624 }, +{ 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, 612 }, +{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 46 }, +{ 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, 636 }, }; static int32_t fcoder_metacmd_ID_allow_mouse = 0; static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 1; diff --git a/4coder_jump_direct.cpp b/4coder_jump_direct.cpp index 9d22d5fd..12325b45 100644 --- a/4coder_jump_direct.cpp +++ b/4coder_jump_direct.cpp @@ -1,26 +1,10 @@ /* 4coder_direct_jump.cpp - Commands and helpers for parsing jump locations from compiler errors and jumping to them in the corresponding buffer. - -TYPE: 'drop-in-command-pack' */ // TOP -//#if !defined(FCODER_JUMP_PARSING) && !defined(FCODER_JUMP_COMMANDS) -//#define FCODER_JUMP_PARSING -//#define FCODER_JUMP_COMMANDS - -#if !defined(FCODER_JUMP_PARSING) -#define FCODER_JUMP_PARSING - -#include "4coder_default_framework.h" -#include "4coder_helper/4coder_long_seek.h" -#include "4coder_helper/4coder_helper.h" - -#include "4coder_lib/4coder_mem.h" -#include "4coder_jumping.h" - CUSTOM_COMMAND_SIG(goto_jump_at_cursor_direct) CUSTOM_DOC("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.") { @@ -144,7 +128,5 @@ CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, o } } -#endif - // BOTTOM diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index 018ffcb8..442f9f10 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -1,25 +1,14 @@ /* 4coder_jump_sticky.cpp - Commands and helpers for parsing jump locations from compiler errors, sticking markers on jump locations, and jumping to them. - -TYPE: 'drop-in-command-pack' */ // TOP -//#if !defined(FCODER_STICKY_JUMP) && !defined(FCODER_JUMP_COMMANDS) -//#define FCODER_STICKY_JUMP -//#define FCODER_JUMP_COMMANDS +static Marker_List_Node *marker_list_first = 0; +static Marker_List_Node *marker_list_last = 0; -#if !defined(FCODER_STICKY_JUMP) -#define FCODER_STICKY_JUMP - -#include "4coder_default_framework.h" -#include "4coder_helper/4coder_long_seek.h" -#include "4coder_helper/4coder_helper.h" - -#include "4coder_lib/4coder_mem.h" -#include "4coder_jumping.h" +//////////////////////////////// static uint32_t binary_search(uint32_t *array, int32_t stride, int32_t count, uint32_t x){ @@ -49,32 +38,6 @@ binary_search(uint32_t *array, int32_t stride, int32_t count, uint32_t x){ return(i); } -enum Jump_Location_Flag{ - JumpFlag_IsSubJump = 0x1, -}; - -struct Sticky_Jump_Destination_Array{ - uint32_t first_jump_index; - Marker_Handle handle; -}; - -struct Sticky_Jump_Source{ - uint32_t line_number; - uint32_t flags; -}; - -struct Marker_List{ - Sticky_Jump_Destination_Array *dst; - int32_t dst_count; - int32_t dst_max; - - Sticky_Jump_Source *jumps; - int32_t jump_count; - int32_t jump_max; - - int32_t previous_size; -}; - static Sticky_Jump_Destination_Array make_sticky_jump_destination_array(uint32_t first_jump_index, Marker_Handle handle){ Sticky_Jump_Destination_Array r; @@ -275,16 +238,6 @@ free_marker_list(General_Memory *general, Marker_List list){ general_memory_free(general, list.jumps); } -struct Marker_List_Node{ - Marker_List_Node *next; - Marker_List_Node *prev; - Marker_List list; - int32_t buffer_id; -}; - -static Marker_List_Node *marker_list_first = 0; -static Marker_List_Node *marker_list_last = 0; - static void delete_marker_list(Marker_List_Node *node){ zdll_remove(marker_list_first, marker_list_last, node); @@ -487,12 +440,6 @@ goto_next_filtered_jump(Application_Links *app, Marker_List *list, View_Summary } } -struct Locked_Jump_State{ - View_Summary view; - Marker_List *list; - int32_t list_index; -}; - static Locked_Jump_State get_locked_jump_state(Application_Links *app, Partition *part, General_Memory *general){ Locked_Jump_State result = {0}; @@ -655,7 +602,5 @@ OPEN_FILE_HOOK_SIG(end_file_close_jump_list){ return(0); } -#endif - // BOTTOM diff --git a/4coder_jump_sticky.h b/4coder_jump_sticky.h new file mode 100644 index 00000000..5c4a5f9e --- /dev/null +++ b/4coder_jump_sticky.h @@ -0,0 +1,52 @@ +/* +4coder_jump_sticky.h - Types for persistant jump positions. +*/ + +// TOP + +#if !defined(FCODER_JUMP_STICKY_H) +#define FCODER_JUMP_STICKY_H + +enum Jump_Location_Flag{ + JumpFlag_IsSubJump = 0x1, +}; + +struct Sticky_Jump_Destination_Array{ + uint32_t first_jump_index; + Marker_Handle handle; +}; + +struct Sticky_Jump_Source{ + uint32_t line_number; + uint32_t flags; +}; + +struct Marker_List{ + Sticky_Jump_Destination_Array *dst; + int32_t dst_count; + int32_t dst_max; + + Sticky_Jump_Source *jumps; + int32_t jump_count; + int32_t jump_max; + + int32_t previous_size; +}; + +struct Marker_List_Node{ + Marker_List_Node *next; + Marker_List_Node *prev; + Marker_List list; + int32_t buffer_id; +}; + +struct Locked_Jump_State{ + View_Summary view; + Marker_List *list; + int32_t list_index; +}; + +#endif + +// BOTTOM + diff --git a/4coder_jumping.cpp b/4coder_jumping.cpp new file mode 100644 index 00000000..f899dd4d --- /dev/null +++ b/4coder_jumping.cpp @@ -0,0 +1,378 @@ +/* +4coder_jumping.cpp - Routines commonly used when writing code to jump to locations and seek through jump lists. +*/ + +// TOP + +static bool32 +ms_style_verify(String line, int32_t left_paren_pos, int32_t right_paren_pos){ + int32_t result = false; + String line_part = substr_tail(line, right_paren_pos); + if (match_part_sc(line_part, ") : ")){ + result = true; + } + else if (match_part_sc(line_part, "): ")){ + result = true; + } + if (result){ + String number = substr(line, left_paren_pos + 1, right_paren_pos - left_paren_pos - 2); + if (!str_is_int_s(number)){ + result = false; + int32_t comma_pos = find_s_char(number, 0, ','); + if (comma_pos < number.size){ + String sub_number0 = substr(number, 0, comma_pos); + String sub_number1 = substr(number, comma_pos, number.size - comma_pos - 1); + if (str_is_int_s(sub_number0) && str_is_int_s(sub_number1)){ + result = true; + } + } + } + } + return(result); +} + +static int32_t +try_skip_rust_arrow(String line){ + int32_t pos = 0; + if (match_part(line, "-->")){ + String sub = substr_tail(line, 3); + sub = skip_chop_whitespace(sub); + pos = (int32_t)(sub.str - line.str); + } + return(pos); +} + +static bool32 +parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *colon_char, bool32 *is_sub_error){ + bool32 result = false; + *is_sub_error = (line.str[0] == ' '); + + int32_t whitespace_length = 0; + line = skip_chop_whitespace(line, &whitespace_length); + + int32_t colon_pos = 0; + bool32 is_ms_style = false; + + int32_t left_paren_pos = find_s_char(line, 0, '('); + int32_t right_paren_pos = find_s_char(line, left_paren_pos, ')'); + while (!is_ms_style && right_paren_pos < line.size){ + if (ms_style_verify(line, left_paren_pos, right_paren_pos)){ + is_ms_style = true; + colon_pos = find_s_char(line, right_paren_pos, ':'); + if (colon_pos < line.size){ + String location_str = substr(line, 0, colon_pos); + + location_str = skip_chop_whitespace(location_str); + + int32_t close_pos = right_paren_pos; + int32_t open_pos = left_paren_pos; + + if (0 < open_pos && open_pos < location_str.size){ + String file = substr(location_str, 0, open_pos); + file = skip_chop_whitespace(file); + + if (file.size > 0){ + String line_number = substr(location_str, + open_pos+1, + close_pos-open_pos-1); + line_number = skip_chop_whitespace(line_number); + + if (line_number.size > 0){ + location->file = file; + + int32_t comma_pos = find_s_char(line_number, 0, ','); + if (comma_pos < line_number.size){ + int32_t start = comma_pos+1; + String column_number = substr(line_number, start, line_number.size-start); + line_number = substr(line_number, 0, comma_pos); + + location->line = str_to_int_s(line_number); + location->column = str_to_int_s(column_number); + } + else{ + location->line = str_to_int_s(line_number); + location->column = 1; + } + + *colon_char = colon_pos + whitespace_length; + result = true; + } + } + } + } + } + else{ + left_paren_pos = find_s_char(line, left_paren_pos + 1, '('); + right_paren_pos = find_s_char(line, left_paren_pos, ')'); + } + } + + if (!is_ms_style){ + int32_t start = try_skip_rust_arrow(line); + + int32_t colon_pos1 = find_s_char(line, start, ':'); + if (line.size > colon_pos1 + 1){ + if (char_is_slash(line.str[colon_pos1 + 1])){ + colon_pos1 = find_s_char(line, colon_pos1 + 1, ':'); + } + } + + int32_t colon_pos2 = find_s_char(line, colon_pos1 + 1, ':'); + int32_t colon_pos3 = find_s_char(line, colon_pos2 + 1, ':'); + + if (colon_pos3 + 1 <= line.size){ + String filename = substr(line, start, colon_pos1 - start); + String line_number = substr(line, colon_pos1 + 1, colon_pos2 - colon_pos1 - 1); + String column_number = substr(line, colon_pos2 + 1, colon_pos3 - colon_pos2 - 1); + + if (filename.size > 0 && + line_number.size > 0 && + column_number.size > 0){ + location->file = filename; + location->line = str_to_int_s(line_number); + location->column = str_to_int_s(column_number); + *colon_char = colon_pos3 + whitespace_length; + result = true; + } + } + else{ + if (colon_pos2 + 1 <= line.size){ + String filename = substr(line, 0, colon_pos1); + String line_number = substr(line, colon_pos1 + 1, colon_pos2 - colon_pos1 - 1); + + if (str_is_int_s(line_number)){ + if (filename.size > 0 && line_number.size > 0){ + location->file = filename; + location->line = str_to_int_s(line_number); + location->column = 0; + *colon_char = colon_pos2 + whitespace_length; + result = true; + } + } + } + } + } + + if (!result){ + *is_sub_error = false; + } + + return(result); +} + +static bool32 +parse_jump_location(String line, bool32 skip_sub_error, Name_Based_Jump_Location *location, int32_t *colon_char){ + bool32 is_sub_error = false; + bool32 result = parse_jump_location(line, location, colon_char, &is_sub_error); + if (is_sub_error && skip_sub_error){ + result = false; + } + return(result); +} + +static int32_t +parse_jump_from_buffer_line(Application_Links *app, Partition *arena, + int32_t buffer_id, int32_t line, + bool32 skip_sub_errors, Name_Based_Jump_Location *location){ + int32_t result = false; + String line_str = {0}; + Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); + if (read_line(app, arena, &buffer, line, &line_str)){ + int32_t colon_char = 0; + if (parse_jump_location(line_str, skip_sub_errors, location, &colon_char)){ + result = true; + } + } + return(result); +} + +//////////////////////////////// + +static bool32 +get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, Name_Based_Jump_Location *location){ + bool32 result = open_file(app, buffer, location->file.str, location->file.size, false, true); + return(result); +} + +static bool32 +get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, ID_Pos_Jump_Location *location){ + *buffer = get_buffer(app, location->buffer_id, AccessAll); + bool32 result = false; + if (buffer->exists){ + result = true; + } + return(result); +} + +static void +switch_to_existing_view(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){ + if (!(view->exists && view->buffer_id == buffer->buffer_id)){ + View_Summary existing_view = get_first_view_with_buffer(app, buffer->buffer_id); + if (existing_view.exists){ + *view = existing_view; + } + } +} + +static void +set_view_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Buffer_Seek seek){ + if (view->buffer_id != buffer->buffer_id){ + view_set_buffer(app, view, buffer->buffer_id, 0); + } + view_set_cursor(app, view, seek, true); +} + +static void +jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Name_Based_Jump_Location location){ + set_active_view(app, view); + set_view_to_location(app, view, buffer, seek_line_char(location.line, location.column)); + if (auto_center_after_jumps){ + center_view(app); + } +} + +static void +jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, ID_Pos_Jump_Location location){ + set_active_view(app, view); + set_view_to_location(app, view, buffer, seek_pos(location.pos)); + if (auto_center_after_jumps){ + center_view(app); + } +} + +//////////////////////////////// + +static bool32 +seek_next_jump_in_buffer(Application_Links *app, Partition *part, + int32_t buffer_id, int32_t first_line, bool32 skip_sub_errors, + int32_t direction, + int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ + + Assert(direction == 1 || direction == -1); + + bool32 result = false; + int32_t line = first_line; + String line_str = {0}; + Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); + for (;;){ + if (read_line(app, part, &buffer, line, &line_str)){ + if (parse_jump_location(line_str, skip_sub_errors, location_out, colon_index_out)){ + result = true; + break; + } + line += direction; + } + else{ + break; + } + } + + if (line < 0){ + line = 0; + } + + *line_out = line; + + return(result); +} + +static ID_Based_Jump_Location +convert_name_based_to_id_based(Application_Links *app, Name_Based_Jump_Location loc){ + ID_Based_Jump_Location result = {0}; + Buffer_Summary buffer = get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll); + + if (buffer.exists){ + result.buffer_id = buffer.buffer_id; + result.line = loc.line; + result.column = loc.column; + } + + return(result); +} + +static int32_t +seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_sub_errors, int32_t direction, int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ + int32_t result = false; + + Name_Based_Jump_Location location = {0}; + int32_t line = view->cursor.line; + int32_t colon_index = 0; + if (seek_next_jump_in_buffer(app, part, view->buffer_id, line+direction, skip_sub_errors, direction, &line, &colon_index, &location)){ + result = true; + *line_out = line; + *colon_index_out = colon_index; + *location_out = location; + } + + return(result); +} + +static bool32 +skip_this_jump(ID_Based_Jump_Location prev, ID_Based_Jump_Location jump){ + bool32 result = false; + if (prev.buffer_id != 0 && prev.buffer_id == jump.buffer_id && prev.line == jump.line && prev.column <= jump.column){ + result = true; + } + return(result); +} + +static bool32 +advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_repeats, int32_t skip_sub_error, int32_t direction, Name_Based_Jump_Location *location_out){ + bool32 result = true; + + Name_Based_Jump_Location location = {0}; + ID_Based_Jump_Location jump = {0}; + int32_t line = 0, colon_index = 0; + + do{ + Temp_Memory temp = begin_temp_memory(part); + if (seek_next_jump_in_view(app, part, view, skip_sub_error, direction, &line, &colon_index, &location)){ + jump = convert_name_based_to_id_based(app, location); + view_set_cursor(app, view, seek_line_char(line, colon_index+1), true); + result = true; + } + else{ + jump.buffer_id = 0; + result = false; + } + end_temp_memory(temp); + }while(skip_repeats && skip_this_jump(prev_location, jump)); + + if (result){ + *location_out = location; + view_set_cursor(app, view, seek_line_char(line, colon_index+1), true); + } + + prev_location = jump; + + return(result); +} + +static bool32 +seek_jump(Application_Links *app, Partition *part, bool32 skip_repeats, bool32 skip_sub_errors, int32_t direction){ + bool32 result = false; + + View_Summary view = get_view_for_locked_jump_buffer(app); + if (view.exists){ + Name_Based_Jump_Location location = {0}; + if (advance_cursor_in_jump_view(app, &global_part, &view, skip_repeats, skip_sub_errors, direction, &location)){ + + Buffer_Summary buffer = {0}; + if (get_jump_buffer(app, &buffer, &location)){ + View_Summary target_view = get_active_view(app, AccessAll); + if (target_view.view_id == view.view_id){ + change_active_panel(app); + target_view = get_active_view(app, AccessAll); + } + switch_to_existing_view(app, &target_view, &buffer); + jump_to_location(app, &target_view, &buffer, location); + result = true; + } + } + } + + return(result); +} + +// BOTTOM + diff --git a/4coder_jumping.h b/4coder_jumping.h index 9add149a..d66462ea 100644 --- a/4coder_jumping.h +++ b/4coder_jumping.h @@ -1,27 +1,11 @@ /* -4coder_jumping.h - Routines commonly used when writing code to jump to locations and seek through jump lists. - -TYPE: 'helper-routines' +4coder_jumping.h - Types used in jumping. */ // TOP -#if !defined(FCODER_JUMPING) -#define FCODER_JUMPING - -#include "4coder_helper/4coder_helper.h" -#include "4coder_helper/4coder_long_seek.h" - -#include "4coder_lib/4coder_mem.h" - -// -// Jump Parsing -// - -#include "4coder_helper/4coder_helper.h" -#include "4coder_helper/4coder_long_seek.h" - -#include "4coder_lib/4coder_mem.h" +#if !defined(FCODER_JUMPING_H) +#define FCODER_JUMPING_H struct ID_Pos_Jump_Location{ Buffer_ID buffer_id; @@ -34,378 +18,6 @@ struct Name_Based_Jump_Location{ int32_t column; }; -static bool32 -ms_style_verify(String line, int32_t left_paren_pos, int32_t right_paren_pos){ - int32_t result = false; - String line_part = substr_tail(line, right_paren_pos); - if (match_part_sc(line_part, ") : ")){ - result = true; - } - else if (match_part_sc(line_part, "): ")){ - result = true; - } - if (result){ - String number = substr(line, left_paren_pos + 1, right_paren_pos - left_paren_pos - 2); - if (!str_is_int_s(number)){ - result = false; - - int32_t comma_pos = find_s_char(number, 0, ','); - if (comma_pos < number.size){ - String sub_number0 = substr(number, 0, comma_pos); - String sub_number1 = substr(number, comma_pos, number.size - comma_pos - 1); - if (str_is_int_s(sub_number0) && str_is_int_s(sub_number1)){ - result = true; - } - } - } - } - return(result); -} - -static int32_t -try_skip_rust_arrow(String line){ - int32_t pos = 0; - if (match_part(line, "-->")){ - String sub = substr_tail(line, 3); - sub = skip_chop_whitespace(sub); - pos = (int32_t)(sub.str - line.str); - } - return(pos); -} - -static bool32 -parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *colon_char, bool32 *is_sub_error){ - bool32 result = false; - *is_sub_error = (line.str[0] == ' '); - - int32_t whitespace_length = 0; - line = skip_chop_whitespace(line, &whitespace_length); - - int32_t colon_pos = 0; - bool32 is_ms_style = false; - - int32_t left_paren_pos = find_s_char(line, 0, '('); - int32_t right_paren_pos = find_s_char(line, left_paren_pos, ')'); - while (!is_ms_style && right_paren_pos < line.size){ - if (ms_style_verify(line, left_paren_pos, right_paren_pos)){ - is_ms_style = true; - colon_pos = find_s_char(line, right_paren_pos, ':'); - if (colon_pos < line.size){ - String location_str = substr(line, 0, colon_pos); - - location_str = skip_chop_whitespace(location_str); - - int32_t close_pos = right_paren_pos; - int32_t open_pos = left_paren_pos; - - if (0 < open_pos && open_pos < location_str.size){ - String file = substr(location_str, 0, open_pos); - file = skip_chop_whitespace(file); - - if (file.size > 0){ - String line_number = substr(location_str, - open_pos+1, - close_pos-open_pos-1); - line_number = skip_chop_whitespace(line_number); - - if (line_number.size > 0){ - location->file = file; - - int32_t comma_pos = find_s_char(line_number, 0, ','); - if (comma_pos < line_number.size){ - int32_t start = comma_pos+1; - String column_number = substr(line_number, start, line_number.size-start); - line_number = substr(line_number, 0, comma_pos); - - location->line = str_to_int_s(line_number); - location->column = str_to_int_s(column_number); - } - else{ - location->line = str_to_int_s(line_number); - location->column = 1; - } - - *colon_char = colon_pos + whitespace_length; - result = true; - } - } - } - } - } - else{ - left_paren_pos = find_s_char(line, left_paren_pos + 1, '('); - right_paren_pos = find_s_char(line, left_paren_pos, ')'); - } - } - - if (!is_ms_style){ - int32_t start = try_skip_rust_arrow(line); - - int32_t colon_pos1 = find_s_char(line, start, ':'); - if (line.size > colon_pos1 + 1){ - if (char_is_slash(line.str[colon_pos1 + 1])){ - colon_pos1 = find_s_char(line, colon_pos1 + 1, ':'); - } - } - - int32_t colon_pos2 = find_s_char(line, colon_pos1 + 1, ':'); - int32_t colon_pos3 = find_s_char(line, colon_pos2 + 1, ':'); - - if (colon_pos3 + 1 <= line.size){ - String filename = substr(line, start, colon_pos1 - start); - String line_number = substr(line, colon_pos1 + 1, colon_pos2 - colon_pos1 - 1); - String column_number = substr(line, colon_pos2 + 1, colon_pos3 - colon_pos2 - 1); - - if (filename.size > 0 && - line_number.size > 0 && - column_number.size > 0){ - location->file = filename; - location->line = str_to_int_s(line_number); - location->column = str_to_int_s(column_number); - *colon_char = colon_pos3 + whitespace_length; - result = true; - } - } - else{ - if (colon_pos2 + 1 <= line.size){ - String filename = substr(line, 0, colon_pos1); - String line_number = substr(line, colon_pos1 + 1, colon_pos2 - colon_pos1 - 1); - - if (str_is_int_s(line_number)){ - if (filename.size > 0 && line_number.size > 0){ - location->file = filename; - location->line = str_to_int_s(line_number); - location->column = 0; - *colon_char = colon_pos2 + whitespace_length; - result = true; - } - } - } - } - } - - if (!result){ - *is_sub_error = false; - } - - return(result); -} - -static bool32 -parse_jump_location(String line, Name_Based_Jump_Location *location, bool32 skip_sub_error, int32_t *colon_char){ - bool32 is_sub_error = false; - bool32 result = parse_jump_location(line, location, colon_char, &is_sub_error); - if (is_sub_error && skip_sub_error){ - result = false; - } - return(result); -} - -static int32_t -parse_jump_from_buffer_line(Application_Links *app, Partition *part, int32_t buffer_id, int32_t line, int32_t skip_sub_errors, Name_Based_Jump_Location *location){ - - int32_t result = false; - String line_str = {0}; - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - if (read_line(app, part, &buffer, line, &line_str)){ - int32_t colon_char = 0; - if (parse_jump_location(line_str, location, skip_sub_errors, &colon_char)){ - result = true; - } - } - - return(result); -} - -// -// Jumping Details -// - -static bool32 -get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, Name_Based_Jump_Location *location){ - bool32 result = open_file(app, buffer, location->file.str, location->file.size, false, true); - return(result); -} - -static bool32 -get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, ID_Pos_Jump_Location *location){ - *buffer = get_buffer(app, location->buffer_id, AccessAll); - bool32 result = false; - if (buffer->exists){ - result = true; - } - return(result); -} - -static void -switch_to_existing_view(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){ - if (!(view->exists && view->buffer_id == buffer->buffer_id)){ - View_Summary existing_view = get_first_view_with_buffer(app, buffer->buffer_id); - if (existing_view.exists){ - *view = existing_view; - } - } -} - -static void -set_view_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Buffer_Seek seek){ - if (view->buffer_id != buffer->buffer_id){ - view_set_buffer(app, view, buffer->buffer_id, 0); - } - view_set_cursor(app, view, seek, true); -} - -static void -jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Name_Based_Jump_Location location){ - set_active_view(app, view); - set_view_to_location(app, view, buffer, seek_line_char(location.line, location.column)); - if (auto_center_after_jumps){ - center_view(app); - } -} - -static void -jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, ID_Pos_Jump_Location location){ - set_active_view(app, view); - set_view_to_location(app, view, buffer, seek_pos(location.pos)); - if (auto_center_after_jumps){ - center_view(app); - } -} - -// -// Jump List Traversing -// - -static bool32 -seek_next_jump_in_buffer(Application_Links *app, Partition *part, int32_t buffer_id, int32_t first_line, bool32 skip_sub_errors, int32_t direction, int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ - - Assert(direction == 1 || direction == -1); - - bool32 result = false; - int32_t line = first_line; - String line_str = {0}; - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - for (;;){ - if (read_line(app, part, &buffer, line, &line_str)){ - if (parse_jump_location(line_str, location_out, skip_sub_errors, colon_index_out)){ - result = true; - break; - } - line += direction; - } - else{ - break; - } - } - - if (line < 0){ - line = 0; - } - - *line_out = line; - - return(result); -} - -static ID_Based_Jump_Location -convert_name_based_to_id_based(Application_Links *app, Name_Based_Jump_Location loc){ - ID_Based_Jump_Location result = {0}; - Buffer_Summary buffer = get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll); - - if (buffer.exists){ - result.buffer_id = buffer.buffer_id; - result.line = loc.line; - result.column = loc.column; - } - - return(result); -} - -static int32_t -seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_sub_errors, int32_t direction, int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ - int32_t result = false; - - Name_Based_Jump_Location location = {0}; - int32_t line = view->cursor.line; - int32_t colon_index = 0; - if (seek_next_jump_in_buffer(app, part, view->buffer_id, line+direction, skip_sub_errors, direction, &line, &colon_index, &location)){ - result = true; - *line_out = line; - *colon_index_out = colon_index; - *location_out = location; - } - - return(result); -} - -static bool32 -skip_this_jump(ID_Based_Jump_Location prev, ID_Based_Jump_Location jump){ - bool32 result = false; - if (prev.buffer_id != 0 && prev.buffer_id == jump.buffer_id && prev.line == jump.line && prev.column <= jump.column){ - result = true; - } - return(result); -} - -static bool32 -advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_repeats, int32_t skip_sub_error, int32_t direction, Name_Based_Jump_Location *location_out){ - bool32 result = true; - - Name_Based_Jump_Location location = {0}; - ID_Based_Jump_Location jump = {0}; - int32_t line = 0, colon_index = 0; - - do{ - Temp_Memory temp = begin_temp_memory(part); - if (seek_next_jump_in_view(app, part, view, skip_sub_error, direction, &line, &colon_index, &location)){ - jump = convert_name_based_to_id_based(app, location); - view_set_cursor(app, view, seek_line_char(line, colon_index+1), true); - result = true; - } - else{ - jump.buffer_id = 0; - result = false; - } - end_temp_memory(temp); - }while(skip_repeats && skip_this_jump(prev_location, jump)); - - if (result){ - *location_out = location; - view_set_cursor(app, view, seek_line_char(line, colon_index+1), true); - } - - prev_location = jump; - - return(result); -} - -static bool32 -seek_jump(Application_Links *app, Partition *part, bool32 skip_repeats, bool32 skip_sub_errors, int32_t direction){ - bool32 result = false; - - View_Summary view = get_view_for_locked_jump_buffer(app); - if (view.exists){ - Name_Based_Jump_Location location = {0}; - if (advance_cursor_in_jump_view(app, &global_part, &view, skip_repeats, skip_sub_errors, direction, &location)){ - - Buffer_Summary buffer = {0}; - if (get_jump_buffer(app, &buffer, &location)){ - View_Summary target_view = get_active_view(app, AccessAll); - if (target_view.view_id == view.view_id){ - change_active_panel(app); - target_view = get_active_view(app, AccessAll); - } - switch_to_existing_view(app, &target_view, &buffer); - jump_to_location(app, &target_view, &buffer, location); - result = true; - } - } - } - - return(result); -} - #endif // BOTTOM diff --git a/4coder_metadata_generator.cpp b/4coder_metadata_generator.cpp index d3220ef9..d8f5a83b 100644 --- a/4coder_metadata_generator.cpp +++ b/4coder_metadata_generator.cpp @@ -1,7 +1,5 @@ /* 4coder_metadata_generator.cpp - A preprocessor program for generating a list of commands and their descriptions. - -TYPE: 'code-preprocessor' */ // TOP diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index b4b14409..f644f75e 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -1,20 +1,9 @@ /* 4coder_project_commands.cpp - commands for loading and using a project. - -type: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_PROJECT_COMMANDS_CPP) -#define FCODER_PROJECT_COMMANDS_CPP - -#include "4coder_project_commands.h" - -#include "4coder_build_commands.cpp" - -/////////////////////////////// - static Project current_project = {0}; /////////////////////////////// @@ -145,36 +134,13 @@ open_all_code_with_project_extensions_in_directory(Application_Links *app, Strin open_all_files_in_directory_with_extension(app, dir, array, flags); } -//////////////////////////////// - -CUSTOM_COMMAND_SIG(close_all_code) -CUSTOM_DOC("Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.") -{ - CString_Array extensions = get_project_extensions(¤t_project); - close_all_files_with_extension(app, &global_part, extensions); -} - -CUSTOM_COMMAND_SIG(open_all_code) -CUSTOM_DOC("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.") -{ - CString_Array extensions = get_project_extensions(¤t_project); - open_all_files_with_extension_in_hot(app, &global_part, extensions, 0); -} - -CUSTOM_COMMAND_SIG(open_all_code_recursive) -CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.") -{ - CString_Array extensions = get_project_extensions(¤t_project); - open_all_files_with_extension_in_hot(app, &global_part, extensions, OpenAllFilesFlag_Recursive); -} - /////////////////////////////// static void -load_project_from_data(Application_Links *app, Partition *scrtach, +load_project_from_data(Application_Links *app, Partition *scratch, char *config_data, int32_t config_data_size, String project_dir){ - Temp_Memory temp = begin_temp_memory(scrtach); + Temp_Memory temp = begin_temp_memory(scratch); char *mem = config_data; int32_t size = config_data_size; @@ -182,11 +148,11 @@ load_project_from_data(Application_Links *app, Partition *scrtach, Cpp_Token_Array array; array.count = 0; array.max_count = (1 << 20)/sizeof(Cpp_Token); - array.tokens = push_array(scrtach, Cpp_Token, array.max_count); + array.tokens = push_array(scratch, Cpp_Token, array.max_count); Cpp_Keyword_Table kw_table = {0}; Cpp_Keyword_Table pp_table = {0}; - lexer_keywords_default_init(scrtach, &kw_table, &pp_table); + lexer_keywords_default_init(scratch, &kw_table, &pp_table); Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); Cpp_Lex_Result result = cpp_lex_step(&S, mem, size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); @@ -194,19 +160,17 @@ load_project_from_data(Application_Links *app, Partition *scrtach, if (result == LexResult_Finished){ // Clear out current project if (current_project.close_all_code_when_this_project_closes){ - exec_command(app, close_all_code); + close_all_files_with_extension(app, scratch, get_project_extensions(¤t_project)); } memset(¤t_project, 0, sizeof(current_project)); current_project.loaded = true; // Set new project directory - { - current_project.dir = current_project.dir_space; - String str = make_fixed_width_string(current_project.dir_space); - copy(&str, project_dir); - terminate_with_null(&str); - current_project.dir_len = str.size; - } + current_project.dir = current_project.dir_space; + String str = make_fixed_width_string(current_project.dir_space); + copy(&str, project_dir); + terminate_with_null(&str); + current_project.dir_len = str.size; // Read the settings from project.4coder for (int32_t i = 0; i < array.count; ++i){ @@ -229,11 +193,9 @@ load_project_from_data(Application_Links *app, Partition *scrtach, } } - { - bool32 open_recursively = false; - if (config_bool_var(item, "open_recursively", 0, &open_recursively)){ - current_project.open_recursively = open_recursively; - } + bool32 open_recursively = false; + if (config_bool_var(item, "open_recursively", 0, &open_recursively)){ + current_project.open_recursively = open_recursively; } { @@ -360,7 +322,7 @@ load_project_from_data(Application_Links *app, Partition *scrtach, if (current_project.close_all_files_when_project_opens){ CString_Array extension_array = {0}; - close_all_files_with_extension(app, scrtach, extension_array); + close_all_files_with_extension(app, scratch, extension_array); } // Open all project files @@ -434,6 +396,29 @@ exec_project_fkey_command(Application_Links *app, int32_t command_ind){ } } +//////////////////////////////// + +CUSTOM_COMMAND_SIG(close_all_code) +CUSTOM_DOC("Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.") +{ + CString_Array extensions = get_project_extensions(¤t_project); + close_all_files_with_extension(app, &global_part, extensions); +} + +CUSTOM_COMMAND_SIG(open_all_code) +CUSTOM_DOC("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.") +{ + CString_Array extensions = get_project_extensions(¤t_project); + open_all_files_with_extension_in_hot(app, &global_part, extensions, 0); +} + +CUSTOM_COMMAND_SIG(open_all_code_recursive) +CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.") +{ + CString_Array extensions = get_project_extensions(¤t_project); + open_all_files_with_extension_in_hot(app, &global_part, extensions, OpenAllFilesFlag_Recursive); +} + /////////////////////////////// CUSTOM_COMMAND_SIG(load_project) @@ -745,7 +730,5 @@ CUSTOM_DOC("Queries the user for several configuration options and initializes a load_project(app); } -#endif - // BOTTOM diff --git a/4coder_project_commands.h b/4coder_project_commands.h index 22e9c6db..bf7794dd 100644 --- a/4coder_project_commands.h +++ b/4coder_project_commands.h @@ -1,7 +1,5 @@ /* 4coder_project_commands.h - type header paired with 4coder_project_commands.cpp - -type: 'type-header' */ // TOP @@ -9,7 +7,6 @@ type: 'type-header' #if !defined(FCODER_PROJECT_COMMANDS_H) #define FCODER_PROJECT_COMMANDS_H -#include "4coder_default_framework.h" #include "4coder_lib/4coder_mem.h" enum{ diff --git a/4coder_remapping_commands.cpp b/4coder_remapping_commands.cpp index 949823cf..bc02201c 100644 --- a/4coder_remapping_commands.cpp +++ b/4coder_remapping_commands.cpp @@ -1,8 +1,6 @@ /* 4coder_remapping_commands.cpp - Commands that remap all of the keys to one of the maps in the set of default maps. - -TYPE: 'drop-in-command-pack' */ // TOP diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index a2636aa0..8dba1427 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -1,16 +1,13 @@ /* 4coder_scope_commands.cpp - A set of commands and helpers relevant for scope level navigation and editing. - -TYPE: 'drop-in-command-pack' */ // TOP -enum{ - FindScope_Parent = 0x1, - FindScope_NextSibling = 0x1, - FindScope_EndOfToken = 0x2, -}; +static bool32 parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out); +static float scope_center_threshold = 0.75f; + +//////////////////////////////// static bool32 find_scope_top(Application_Links *app, Buffer_Summary *buffer, int32_t start_pos, uint32_t flags, int32_t *end_pos_out){ @@ -341,8 +338,6 @@ view_set_to_region(Application_Links *app, View_Summary *view, int32_t major_pos } } -static float scope_center_threshold = 0.75f; - CUSTOM_COMMAND_SIG(highlight_surrounding_scope) CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.") { @@ -530,12 +525,6 @@ CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves } } -struct Statement_Parser{ - Stream_Tokens stream; - int32_t token_index; - Buffer_Summary *buffer; -}; - static Cpp_Token* parser_next_token(Statement_Parser *parser){ Cpp_Token *result = 0; @@ -550,8 +539,6 @@ parser_next_token(Statement_Parser *parser){ return(result); } -static bool32 parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out); - static bool32 parse_for_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out){ bool32 success = false; diff --git a/4coder_scope_commands.h b/4coder_scope_commands.h new file mode 100644 index 00000000..746d0cdf --- /dev/null +++ b/4coder_scope_commands.h @@ -0,0 +1,25 @@ +/* +4coder_scope_commands.cpp - A set of commands and helpers relevant for scope level navigation and editing. +*/ + +// TOP + +#if !defined(FCODER_SCOPE_COMMANDS_H) +#define FCODER_SCOPE_COMMANDS_H + +enum{ + FindScope_Parent = 0x1, + FindScope_NextSibling = 0x1, + FindScope_EndOfToken = 0x2, +}; + +struct Statement_Parser{ + Stream_Tokens stream; + int32_t token_index; + Buffer_Summary *buffer; +}; + +#endif + +// BOTTOM + diff --git a/4coder_search.cpp b/4coder_search.cpp index 19613de7..ee4dd541 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -1,8 +1,6 @@ /* 4coder_search.cpp - Commands that search accross buffers including word complete, and list all locations. - -TYPE: 'drop-in-command-pack' */ // TOP @@ -18,8 +16,6 @@ TYPE: 'drop-in-command-pack' #include "4coder_helper/4coder_streaming.h" #include "4coder_helper/4coder_long_seek.h" -#include "4coder_default_framework.h" - // // Search Iteration Systems // diff --git a/4coder_search.h b/4coder_search.h index a0bcc5b6..578d13e9 100644 --- a/4coder_search.h +++ b/4coder_search.h @@ -1,7 +1,5 @@ /* 4coder_search.h - Types that are used in the search accross all buffers procedures. - -TYPE: 'types-header' */ // TOP diff --git a/4coder_system_command.cpp b/4coder_system_command.cpp index 69a9e3bf..5d3b0a11 100644 --- a/4coder_system_command.cpp +++ b/4coder_system_command.cpp @@ -1,16 +1,9 @@ /* 4coder_system_command.cpp - Commands for executing arbitrary system command line instructions. - -TYPE: 'drop-in-command-pack' */ // TOP -#if !defined(FCODER_SYSTEM_COMMAND_CPP) -#define FCODER_SYSTEM_COMMAND_CPP - -#include "4coder_default_framework.h" - CUSTOM_COMMAND_SIG(execute_previous_cli) CUSTOM_DOC("If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.") { @@ -45,7 +38,5 @@ CUSTOM_DOC("Queries for an output buffer name and system command, runs the syste execute_previous_cli(app); } -#endif - // BOTTOM diff --git a/languages/4coder_language_cpp.h b/languages/4coder_language_cpp.h index 7e94cd24..e19ab9a0 100644 --- a/languages/4coder_language_cpp.h +++ b/languages/4coder_language_cpp.h @@ -1,7 +1,5 @@ /* 4coder_language_cpp.h - Sets up the C++ language context. - -TYPE: 'langauge-description' */ // TOP diff --git a/languages/4coder_language_cs.h b/languages/4coder_language_cs.h index 1d1559c0..e318c8eb 100644 --- a/languages/4coder_language_cs.h +++ b/languages/4coder_language_cs.h @@ -1,7 +1,5 @@ /* 4coder_language_cs.h - Sets up the C# language context. - -TYPE: 'langauge-description' */ // TOP diff --git a/languages/4coder_language_java.h b/languages/4coder_language_java.h index 89ed5b3d..90c40c82 100644 --- a/languages/4coder_language_java.h +++ b/languages/4coder_language_java.h @@ -1,7 +1,5 @@ /* 4coder_language_java.h - Sets up the Java language context. - -TYPE: 'langauge-description' */ // TOP diff --git a/languages/4coder_language_rust.h b/languages/4coder_language_rust.h index b7e6669a..b5c5e35a 100644 --- a/languages/4coder_language_rust.h +++ b/languages/4coder_language_rust.h @@ -1,7 +1,5 @@ /* 4coder_language_rust.h - Sets up the Rust language context. - -TYPE: 'langauge-description' */ // TOP diff --git a/meta/4ed_build.cpp b/meta/4ed_build.cpp index d5ca0eb2..1708e6e3 100644 --- a/meta/4ed_build.cpp +++ b/meta/4ed_build.cpp @@ -239,7 +239,6 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c } if (flags & ICON){ - // TODO(allen): Get this icon in the non-source repository to avoid having to work around it in the future. fm_add_to_line(line, CL_ICON); } diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index f7a2d274..de7ff83a 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -1,7 +1,5 @@ /* 4coder_experiments.cpp - Supplies extension bindings to the defaults with experimental new features. - -TYPE: 'build-target' */ // TOP diff --git a/power/4coder_miblo_numbers.cpp b/power/4coder_miblo_numbers.cpp index 33ad7bef..eb7cdb29 100644 --- a/power/4coder_miblo_numbers.cpp +++ b/power/4coder_miblo_numbers.cpp @@ -1,8 +1,6 @@ /* 4coder_miblo_numbers.cpp - Commands for so called "Miblo Number Operations" which involve incrementing and decrementing various forms of number as numerical objects despite being encoded as text objects. - -TYPE: 'drop-in-command-pack' */ // TOP