From cd299761e9f80b674a4b439defd935c4aa3786ec Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 27 Feb 2019 13:14:25 -0800 Subject: [PATCH] Line numbers --- 4coder_API/4coder_default_colors.h | 4 +- 4coder_API/4coder_types.h | 31 +++++-- 4coder_base_commands.cpp | 6 ++ 4coder_base_types.h | 2 +- 4coder_config.cpp | 6 ++ 4coder_config.h | 2 + 4coder_default_hooks.cpp | 99 ++++++++++++++------- 4coder_fancy.cpp | 35 +++++++- 4coder_generated/command_metadata.h | 129 ++++++++++++++-------------- 4coder_generated/remapping.h | 36 +++++++- 4coder_lists.cpp | 20 +++-- 4coder_ui_helper.cpp | 10 +++ 4ed.cpp | 5 +- 4ed_render_format.cpp | 6 +- 4ed_view.cpp | 6 +- 4ed_view_ui.cpp | 105 ---------------------- meta/4ed_metagen.cpp | 17 +++- 17 files changed, 285 insertions(+), 234 deletions(-) diff --git a/4coder_API/4coder_default_colors.h b/4coder_API/4coder_default_colors.h index b62c41fc..fcc9eee4 100644 --- a/4coder_API/4coder_default_colors.h +++ b/4coder_API/4coder_default_colors.h @@ -48,7 +48,9 @@ enum Style_Tag{ Stag_Text_Cycle_2 = 39, Stag_Text_Cycle_3 = 40, Stag_Text_Cycle_4 = 41, - Stag_COUNT = 42 + Stag_Line_Numbers_Back = 42, + Stag_Line_Numbers_Text = 43, + Stag_COUNT = 44 }; #define FirstCustomColor Stag_COUNT diff --git a/4coder_API/4coder_types.h b/4coder_API/4coder_types.h index 959e3f91..c7a28b79 100644 --- a/4coder_API/4coder_types.h +++ b/4coder_API/4coder_types.h @@ -577,14 +577,26 @@ STRUCT Full_Cursor{ i32 character; /* DOC(This field contains the number of the line where the cursor is located, taking the line wrapping into account. This field is one based.) */ i32 wrap_line; - /* DOC(This field contains the x position measured with unwrapped lines.) */ - float unwrapped_x; - /* DOC(This field contains the y position measured with unwrapped lines.) */ - float unwrapped_y; - /* DOC(This field contains the x position measured with wrapped lines.) */ - float wrapped_x; - /* DOC(This field contains the y position measured with wrapped lines.) */ - float wrapped_y; + union{ + struct{ + /* DOC(This field contains the x position measured with unwrapped lines.) */ + f32 unwrapped_x; + /* DOC(This field contains the y position measured with unwrapped lines.) */ + f32 unwrapped_y; + }; + /* DOC(TODO) */ + Vec2 unwrapped_p; + }; + union{ + struct{ + /* DOC(This field contains the x position measured with wrapped lines.) */ + f32 wrapped_x; + /* DOC(This field contains the y position measured with wrapped lines.) */ + f32 wrapped_y; + }; + /* DOC(TODO) */ + Vec2 wrapped_p; + }; }; /* DOC(Partial_Cursor describes the position of a cursor in all of the coordinate systems that a invariant to the View. In other words the coordinate systems available here can be used on a buffer that is not currently associated with a View.) @@ -616,7 +628,7 @@ STRUCT Buffer_Summary{ /* DOC(If this is not a null summary, this field indicates whether the buffer has finished loading.) */ b32 ready; /* DOC(If this is not a null summary this field is the id of the associated buffer. If this is a null summary then buffer_id is 0.) */ - i32 buffer_id; + Buffer_ID buffer_id; /* DOC(If this is not a null summary, this field contains flags describing the protection status of the buffer.) */ Access_Flag lock_flags; @@ -1053,6 +1065,7 @@ STRUCT Render_Parameters{ Frame_Info frame; View_ID view_id; Range on_screen_range; + Rect_i32 buffer_region; Render_Callback *do_core_render; }; diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index fde0c500..04e47188 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -653,6 +653,12 @@ CUSTOM_DOC("Toggles the current buffer's whitespace visibility status.") view_set_setting(app, &view, ViewSetting_ShowWhitespace, !view.show_whitespace); } +CUSTOM_COMMAND_SIG(toggle_line_numbers) +CUSTOM_DOC("Toggles the left margin line numbers.") +{ + global_config.show_line_number_margins = !global_config.show_line_number_margins; +} + CUSTOM_COMMAND_SIG(eol_dosify) CUSTOM_DOC("Puts the buffer in DOS line ending mode.") { diff --git a/4coder_base_types.h b/4coder_base_types.h index 3b49d17a..c27b8b73 100644 --- a/4coder_base_types.h +++ b/4coder_base_types.h @@ -224,7 +224,7 @@ static const u64 bit_63 = (((u64)1) << (31 + 32)); #define zdll_remove(f,l,n) Stmnt( zdll_remove_((f),(l),(n)) ) #define sll_clear(f,l) (f)=(l)=0 -#define sll_push(f,l,n) Stmnt( if((f)==0&&(l)==0){(f)=(l)=(n);}else{(l)->next=(n);(l)=(n);}(l)->next=0; ) +#define sll_push(f,l,n) Stmnt( if((f)==0||(l)==0){(f)=(l)=(n);}else{(l)->next=(n);(l)=(n);}(n)->next=0; ) #define sll_pop(f,l) Stmnt( if((f)!=(l)){(f)=(f)->next;}else{(f)=(l)=0;} ) #define sll_init_sentinel(s) Stmnt( (s)->next=(s); ) diff --git a/4coder_config.cpp b/4coder_config.cpp index 00794060..d0e6a05c 100644 --- a/4coder_config.cpp +++ b/4coder_config.cpp @@ -1363,6 +1363,8 @@ config_init_default(Config_Data *config){ config->use_scope_highlight = true; config->use_paren_helper = true; config->use_comment_keyword = true; + config->file_lister_per_character_backspace = false; + config->show_line_number_margins = false; config->enable_virtual_whitespace = true; config->enable_code_wrapping = true; @@ -1431,6 +1433,8 @@ config_parse__data(Partition *arena, String file_name, String data, Config_Data config_bool_var(parsed, "use_scope_highlight", 0, &config->use_scope_highlight); config_bool_var(parsed, "use_paren_helper", 0, &config->use_paren_helper); config_bool_var(parsed, "use_comment_keyword", 0, &config->use_comment_keyword); + config_bool_var(parsed, "file_lister_per_character_backspace", 0, &config->file_lister_per_character_backspace); + config_bool_var(parsed, "show_line_number_margins", 0, &config->show_line_number_margins); config_bool_var(parsed, "enable_virtual_whitespace", 0, &config->enable_virtual_whitespace); @@ -1652,6 +1656,8 @@ load_config_and_apply(Application_Links *app, Partition *scratch, Config_Data *c config_feedback_bool(&space, "use_scope_highlight", config->use_scope_highlight); config_feedback_bool(&space, "use_paren_helper", config->use_paren_helper); config_feedback_bool(&space, "use_comment_keyword", config->use_comment_keyword); + config_feedback_bool(&space, "file_lister_per_character_backspace", config->file_lister_per_character_backspace); + config_feedback_bool(&space, "show_line_number_margins", config->show_line_number_margins); config_feedback_bool(&space, "enable_virtual_whitespace", config->enable_virtual_whitespace); config_feedback_bool(&space, "enable_code_wrapping", config->enable_code_wrapping); diff --git a/4coder_config.h b/4coder_config.h index 0beae7dd..6f2b91a2 100644 --- a/4coder_config.h +++ b/4coder_config.h @@ -208,6 +208,8 @@ struct Config_Data{ b32 use_scope_highlight; b32 use_paren_helper; b32 use_comment_keyword; + b32 file_lister_per_character_backspace; + b32 show_line_number_margins; b32 enable_virtual_whitespace; b32 enable_code_wrapping; diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 107c3b3a..27dcea07 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -262,6 +262,9 @@ MODIFY_COLOR_TABLE_SIG(default_modify_color_table){ default_colors[Stag_Text_Cycle_2] = 0xFF00A000; default_colors[Stag_Text_Cycle_3] = 0xFF0030B0; default_colors[Stag_Text_Cycle_4] = 0xFFA0A000; + + default_colors[Stag_Line_Numbers_Back] = 0xFF101010; + default_colors[Stag_Line_Numbers_Text] = 0xFF404040; } Color_Table color_table = {}; @@ -296,6 +299,19 @@ GET_VIEW_BUFFER_REGION_SIG(default_view_buffer_region){ } } + // line number margins + if (global_config.show_line_number_margins){ + Buffer_Summary buffer = {}; + get_buffer_summary(app, view.buffer_id, AccessAll, &buffer); + i32 line_count_digit_count = int_to_str_size(buffer.line_count); + Face_ID font_id = 0; + get_face_id(app, view.buffer_id, &font_id); + // TODO(allen): I need a "digit width" + f32 zero = get_string_advance(app, font_id, make_lit_string("0")); + i32 margin_width = ceil32((f32)line_count_digit_count*zero); + sub_region.x0 += margin_width + 2; + } + return(sub_region); } @@ -317,21 +333,16 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa Partition *scratch = &global_part; { - f32 y_cursor = 0; - f32 x_min = (f32)view.render_region.x0; - f32 x_max = (f32)view.render_region.x1; + Rect_f32 r_cursor = f32R(view.render_region); // NOTE(allen): Filebar { b32 showing_file_bar = false; if (view_get_setting(app, render_params.view_id, ViewSetting_ShowFileBar, &showing_file_bar)){ if (showing_file_bar){ - Rect_f32 bar = {}; - bar.x0 = x_min; - bar.x1 = x_max; - bar.y0 = y_cursor; + Rect_f32 bar = r_cursor; bar.y1 = bar.y0 + line_height + 2.f; - y_cursor = bar.y1; + r_cursor.y0 = bar.y1; draw_rectangle(app, bar, Stag_Bar); @@ -391,12 +402,9 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa for (i32 i = 0; i < query_bars.count; i += 1){ Query_Bar *query_bar = query_bars.ptrs[i]; - Rect_f32 bar = {}; - bar.x0 = x_min; - bar.x1 = x_max; - bar.y0 = y_cursor; + Rect_f32 bar = r_cursor; bar.y1 = bar.y0 + line_height + 2.f; - y_cursor = bar.y1; + r_cursor.y0 = bar.y1; Temp_Memory_Arena temp = begin_temp_memory(&arena); Fancy_String_List list = {}; @@ -416,6 +424,43 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa } } } + + // NOTE(allen): Line Numbers + if (global_config.show_line_number_margins){ + i32 line_count_digit_count = int_to_str_size(buffer.line_count); + Face_ID font_id = 0; + get_face_id(app, view.buffer_id, &font_id); + // TODO(allen): I need a "digit width" + f32 zero = get_string_advance(app, font_id, make_lit_string("0")); + f32 margin_width = (f32)line_count_digit_count*zero; + + Rect_f32 left_margin = r_cursor; + left_margin.x1 = left_margin.x0 + margin_width + 2; + r_cursor.x0 = left_margin.x1; + + draw_rectangle(app, left_margin, Stag_Line_Numbers_Back); + + Fancy_Color line_color = fancy_id(Stag_Line_Numbers_Text); + + Full_Cursor cursor = {}; + view_compute_cursor(app, render_params.view_id, seek_pos(render_params.on_screen_range.first), &cursor); + for (;cursor.pos <= render_params.on_screen_range.one_past_last;){ + Vec2 p = panel_space_from_view_space(cursor.wrapped_p, view.scroll_vars.scroll_p); + p += V2(render_params.buffer_region.p0); + if (p.y >= left_margin.y0){ + p.x = left_margin.x0; + Temp_Memory_Arena temp = begin_temp_memory(&arena); + Fancy_String *line_string = push_fancy_stringf(&arena, line_color, "%*d", line_count_digit_count, cursor.line); + draw_fancy_string(app, font_id, line_string, p, Stag_Margin_Active, 0); + end_temp_memory(temp); + } + i32 next_line = cursor.line + 1; + view_compute_cursor(app, render_params.view_id, seek_line_char(next_line, 1), &cursor); + if (cursor.line < next_line){ + break; + } + } + } } // NOTE(allen): Scan for TODOs and NOTEs @@ -790,15 +835,15 @@ HOOK_SIG(default_view_adjust){ Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); i32 view_width = view.render_region.x1 - view.render_region.x0; Face_ID face_id = get_default_font_for_view(app, view.view_id); - float em = get_string_advance(app, face_id, make_lit_string("m")); + f32 em = get_string_advance(app, face_id, make_lit_string("m")); - float wrap_width = view_width - 2.0f*em; - float min_width = 40.0f*em; + f32 wrap_width = view_width - 2.0f*em; + f32 min_width = 40.0f*em; if (wrap_width < min_width){ wrap_width = min_width; } - float min_base_width = 20.0f*em; + f32 min_base_width = 20.0f*em; buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, (i32)(wrap_width)); buffer_set_setting(app, &buffer, BufferSetting_MinimumBaseWrapPosition, (i32)(min_base_width)); } @@ -1164,28 +1209,24 @@ INPUT_FILTER_SIG(default_suppress_mouse_filter){ // 4coder scrolling behavior. // -struct Scroll_Velocity{ - float x, y; -}; - -Scroll_Velocity scroll_velocity_[16] = {}; -Scroll_Velocity *scroll_velocity = scroll_velocity_ - 1; +Vec2 scroll_velocity_[16] = {}; +Vec2 *scroll_velocity = scroll_velocity_ - 1; static i32 -smooth_camera_step(float target, float *current, float *vel, float S, float T){ +smooth_camera_step(f32 target, f32 *current, f32 *vel, f32 S, f32 T){ i32 result = 0; - float curr = *current; - float v = *vel; + f32 curr = *current; + f32 v = *vel; if (curr != target){ if (curr > target - .1f && curr < target + .1f){ curr = target; v = 1.f; } else{ - float L = curr + T*(target - curr); + f32 L = curr + T*(target - curr); i32 sign = (target > curr) - (target < curr); - float V = curr + sign*v; + f32 V = curr + sign*v; if (sign > 0) curr = (LV)?(L):(V); @@ -1203,7 +1244,7 @@ smooth_camera_step(float target, float *current, float *vel, float S, float T){ } SCROLL_RULE_SIG(smooth_scroll_rule){ - Scroll_Velocity *velocity = scroll_velocity + view_id; + Vec2 *velocity = scroll_velocity + view_id; i32 result = 0; if (velocity->x == 0.f){ velocity->x = 1.f; diff --git a/4coder_fancy.cpp b/4coder_fancy.cpp index 655d6359..29d0832b 100644 --- a/4coder_fancy.cpp +++ b/4coder_fancy.cpp @@ -131,7 +131,7 @@ push_fancy_string(Arena *arena, String value){ } static Fancy_String* -push_fancy_vstringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){ +push_fancy_stringfv(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){ // TODO(casey): Allen, ideally we would have our own formatter here that just outputs into a buffer and can't ever "run out of space". char temp[1024]; i32 length = vsprintf(temp, format, args); @@ -146,7 +146,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_vstringf(arena, list, fore, back, format, args); + Fancy_String *result = push_fancy_stringfv(arena, list, fore, back, format, args); va_end(args); return(result); } @@ -155,7 +155,7 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_vstringf(arena, list, fore, pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, list, fore, pass_through_fancy_color(), format, args); va_end(args); return(result); } @@ -164,7 +164,34 @@ static Fancy_String* push_fancy_stringf(Arena *arena, Fancy_String_List *list, char *format, ...){ va_list args; va_start(args, format); - Fancy_String *result = push_fancy_vstringf(arena, list, pass_through_fancy_color(), pass_through_fancy_color(), format, args); + Fancy_String *result = push_fancy_stringfv(arena, list, pass_through_fancy_color(), pass_through_fancy_color(), format, args); + va_end(args); + return(result); +} + +static Fancy_String* +push_fancy_stringf(Arena *arena, Fancy_Color fore, Fancy_Color back, char *format, ...){ + va_list args; + va_start(args, format); + Fancy_String *result = push_fancy_stringfv(arena, 0, fore, back, format, args); + va_end(args); + return(result); +} + +static Fancy_String* +push_fancy_stringf(Arena *arena, Fancy_Color fore, char *format, ...){ + va_list args; + va_start(args, format); + Fancy_String *result = push_fancy_stringfv(arena, 0, fore, pass_through_fancy_color(), format, args); + va_end(args); + return(result); +} + +static Fancy_String* +push_fancy_stringf(Arena *arena, char *format, ...){ + va_list args; + va_start(args, format); + Fancy_String *result = push_fancy_stringfv(arena, 0, pass_through_fancy_color(), pass_through_fancy_color(), format, args); va_end(args); return(result); } diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 8a67d3cf..8490525d 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 233 +#define command_one_past_last_id 234 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -221,6 +221,7 @@ CUSTOM_COMMAND_SIG(toggle_fps_meter); CUSTOM_COMMAND_SIG(toggle_fullscreen); CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes); CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor); +CUSTOM_COMMAND_SIG(toggle_line_numbers); CUSTOM_COMMAND_SIG(toggle_line_wrap); CUSTOM_COMMAND_SIG(toggle_mouse); CUSTOM_COMMAND_SIG(toggle_paren_matching_helper); @@ -253,7 +254,7 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[233] = { +static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 247 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 629 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 640 }, @@ -275,7 +276,7 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 }, { PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 }, { PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 514 }, -{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 973 }, +{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 975 }, { PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 135 }, { PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 159 }, { PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 }, @@ -285,16 +286,16 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 586 }, { PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 83 }, { 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, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 515 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1172 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1424 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1178 }, +{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1430 }, { PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 139 }, { PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1263 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1402 }, -{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 656 }, -{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 664 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1408 }, +{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 662 }, +{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 670 }, { 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, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 23 }, { 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, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 }, -{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 672 }, +{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 678 }, { PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1176 }, { PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1184 }, { 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, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 84 }, @@ -304,7 +305,7 @@ static Command_Metadata fcoder_metacmd_table[233] = { { 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, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 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, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 373 }, { 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, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 345 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 680 }, +{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 }, { 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, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 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, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 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, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 498 }, @@ -318,12 +319,12 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 79 }, { PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 597 }, { PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 575 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 774 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 884 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 916 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 846 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 755 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1594 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 776 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 886 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 918 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 848 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 757 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1600 }, { PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 167 }, { PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 332 }, @@ -356,9 +357,9 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 31 }, { PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 125 }, { PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 192 }, -{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 252 }, +{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 256 }, { PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1083 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1282 }, +{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1288 }, { PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 }, { 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, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 383 }, { 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, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 395 }, @@ -371,8 +372,8 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 332 }, { PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 338 }, { PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 369 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1379 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1315 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1385 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1321 }, { PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 379 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 314 }, { PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 326 }, @@ -383,12 +384,12 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 570 }, { PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 }, { PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1501 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1820 }, +{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1507 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1826 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 55 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 71 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 63 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1537 }, +{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1543 }, { PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 178 }, { PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 169 }, { PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 }, @@ -401,25 +402,25 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1527 }, { PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1090 }, { PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1113 }, -{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1056 }, -{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1080 }, -{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1098 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1717 }, -{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1631 }, +{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1062 }, +{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1086 }, +{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1104 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1723 }, +{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1637 }, { PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 297 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1238 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1244 }, { 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, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 383 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1609 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1615 }, { 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, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 780 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 935 }, -{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 906 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 924 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1601 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1142 }, -{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1198 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 941 }, +{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 912 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 930 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1607 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1148 }, +{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1204 }, { 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, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 750 }, -{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 899 }, -{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 913 }, +{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 905 }, +{ 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, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 919 }, { PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1237 }, { 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, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1249 }, { 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, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1243 }, @@ -458,7 +459,7 @@ static Command_Metadata fcoder_metacmd_table[233] = { { PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1275 }, { PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 248 }, { PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 241 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1561 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1567 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 421 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 401 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 551 }, @@ -466,15 +467,16 @@ static Command_Metadata fcoder_metacmd_table[233] = { { 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, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 289 }, { PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 277 }, { PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 271 }, +{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 656 }, { PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 560 }, { PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 253 }, { PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 283 }, { PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 649 }, { PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 638 }, { PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 147 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 }, -{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1619 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1551 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1651 }, +{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1625 }, +{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 }, { PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 108 }, { PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 958 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 652 }, @@ -700,25 +702,26 @@ static int32_t fcoder_metacmd_ID_toggle_fps_meter = 208; static int32_t fcoder_metacmd_ID_toggle_fullscreen = 209; static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 210; static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 211; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 212; -static int32_t fcoder_metacmd_ID_toggle_mouse = 213; -static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 214; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 215; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 216; -static int32_t fcoder_metacmd_ID_uncomment_line = 217; -static int32_t fcoder_metacmd_ID_undo = 218; -static int32_t fcoder_metacmd_ID_undo_this_buffer = 219; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 220; -static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 221; -static int32_t fcoder_metacmd_ID_word_complete = 222; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 223; -static int32_t fcoder_metacmd_ID_write_block = 224; -static int32_t fcoder_metacmd_ID_write_character = 225; -static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 226; -static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 227; -static int32_t fcoder_metacmd_ID_write_hack = 228; -static int32_t fcoder_metacmd_ID_write_note = 229; -static int32_t fcoder_metacmd_ID_write_todo = 230; -static int32_t fcoder_metacmd_ID_write_underscore = 231; -static int32_t fcoder_metacmd_ID_write_zero_struct = 232; +static int32_t fcoder_metacmd_ID_toggle_line_numbers = 212; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 213; +static int32_t fcoder_metacmd_ID_toggle_mouse = 214; +static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 215; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 216; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 217; +static int32_t fcoder_metacmd_ID_uncomment_line = 218; +static int32_t fcoder_metacmd_ID_undo = 219; +static int32_t fcoder_metacmd_ID_undo_this_buffer = 220; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 221; +static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 222; +static int32_t fcoder_metacmd_ID_word_complete = 223; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 224; +static int32_t fcoder_metacmd_ID_write_block = 225; +static int32_t fcoder_metacmd_ID_write_character = 226; +static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 227; +static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 228; +static int32_t fcoder_metacmd_ID_write_hack = 229; +static int32_t fcoder_metacmd_ID_write_note = 230; +static int32_t fcoder_metacmd_ID_write_todo = 231; +static int32_t fcoder_metacmd_ID_write_underscore = 232; +static int32_t fcoder_metacmd_ID_write_zero_struct = 233; #endif diff --git a/4coder_generated/remapping.h b/4coder_generated/remapping.h index e0465d13..b036e153 100644 --- a/4coder_generated/remapping.h +++ b/4coder_generated/remapping.h @@ -165,6 +165,13 @@ bind(context, key_esc, MDFR_NONE, lister__quit); bind(context, '\n', MDFR_NONE, lister__activate); bind(context, '\t', MDFR_NONE, lister__activate); bind(context, key_back, MDFR_NONE, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL, lister__backspace_text_field); +bind(context, key_back, MDFR_ALT, lister__backspace_text_field); +bind(context, key_back, MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_ALT, lister__backspace_text_field); +bind(context, key_back, MDFR_ALT|MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_ALT|MDFR_CMND, lister__backspace_text_field); bind(context, key_up, MDFR_NONE, lister__move_up); bind(context, 'k', MDFR_ALT, lister__move_up); bind(context, key_page_up, MDFR_NONE, lister__move_up); @@ -340,6 +347,13 @@ bind(context, key_esc, MDFR_NONE, lister__quit); bind(context, '\n', MDFR_NONE, lister__activate); bind(context, '\t', MDFR_NONE, lister__activate); bind(context, key_back, MDFR_NONE, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL, lister__backspace_text_field); +bind(context, key_back, MDFR_ALT, lister__backspace_text_field); +bind(context, key_back, MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_ALT, lister__backspace_text_field); +bind(context, key_back, MDFR_ALT|MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_CMND, lister__backspace_text_field); +bind(context, key_back, MDFR_CTRL|MDFR_ALT|MDFR_CMND, lister__backspace_text_field); bind(context, key_up, MDFR_NONE, lister__move_up); bind(context, key_page_up, MDFR_NONE, lister__move_up); bind(context, key_down, MDFR_NONE, lister__move_down); @@ -542,12 +556,19 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[31] = { {0, 50, 2, "open_matching_file_cpp", 22, LINK_PROCS(open_matching_file_cpp)}, {0, 48, 1, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)}, }; -static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[16] = { +static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[23] = { {1, 0, 0, "lister__write_character", 23, LINK_PROCS(lister__write_character)}, {0, 55307, 0, "lister__quit", 12, LINK_PROCS(lister__quit)}, {0, 10, 0, "lister__activate", 16, LINK_PROCS(lister__activate)}, {0, 9, 0, "lister__activate", 16, LINK_PROCS(lister__activate)}, {0, 55296, 0, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 1, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 2, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 4, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 3, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 6, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 5, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 7, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, {0, 55297, 0, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, {0, 107, 2, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, {0, 55305, 0, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, @@ -564,7 +585,7 @@ static Meta_Sub_Map fcoder_submaps_for_default[4] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 43}, {"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 78}, {"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_default_default_code_map, 31}, -{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 16}, +{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 23}, }; static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[40] = { {0, 44, 4, "change_active_panel", 19, LINK_PROCS(change_active_panel)}, @@ -720,12 +741,19 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[31] = { {0, 50, 1, "open_matching_file_cpp", 22, LINK_PROCS(open_matching_file_cpp)}, {0, 48, 4, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)}, }; -static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[14] = { +static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[21] = { {1, 0, 0, "lister__write_character", 23, LINK_PROCS(lister__write_character)}, {0, 55307, 0, "lister__quit", 12, LINK_PROCS(lister__quit)}, {0, 10, 0, "lister__activate", 16, LINK_PROCS(lister__activate)}, {0, 9, 0, "lister__activate", 16, LINK_PROCS(lister__activate)}, {0, 55296, 0, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 1, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 2, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 4, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 3, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 6, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 5, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, +{0, 55296, 7, "lister__backspace_text_field", 28, LINK_PROCS(lister__backspace_text_field)}, {0, 55297, 0, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, {0, 55305, 0, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, {0, 55298, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, @@ -740,7 +768,7 @@ static Meta_Sub_Map fcoder_submaps_for_mac_default[4] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_mac_default_mapid_global, 40}, {"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_mac_default_mapid_file, 77}, {"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_mac_default_default_code_map, 31}, -{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_mac_default_default_lister_ui_map, 14}, +{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_mac_default_default_lister_ui_map, 21}, }; static Meta_Mapping fcoder_meta_maps[2] = { {"default", 7, "The default 4coder bindings - typically good for Windows and Linux", 66, fcoder_submaps_for_default, 4, LINK_PROCS(fill_keys_default)}, diff --git a/4coder_lists.cpp b/4coder_lists.cpp index b66b4c3b..a6237711 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -226,17 +226,21 @@ CUSTOM_DOC("A lister mode command that backspaces one character from the text fi backspace_utf8(&state->lister.data.text_field); if (last_char == '/' || last_char == '\\'){ User_Input input = get_command_input(app); - b32 is_modified = - input.key.modifiers[MDFR_SHIFT_INDEX] || - input.key.modifiers[MDFR_CONTROL_INDEX] || - input.key.modifiers[MDFR_ALT_INDEX] || - input.key.modifiers[MDFR_COMMAND_INDEX]; String new_hot = path_of_directory(state->lister.data.text_field); - if (!is_modified){ + b32 is_modified = (input.key.modifiers[MDFR_SHIFT_INDEX] || + input.key.modifiers[MDFR_CONTROL_INDEX] || + input.key.modifiers[MDFR_ALT_INDEX] || + input.key.modifiers[MDFR_COMMAND_INDEX]); + b32 whole_word_backspace = (is_modified == global_config.file_lister_per_character_backspace); + if (whole_word_backspace){ state->lister.data.text_field.size = new_hot.size; } directory_set_hot(app, new_hot.str, new_hot.size); + // TODO(allen): We have to protect against lister_call_refresh_handler changing + // the text_field here. Clean this up. + String dingus = state->lister.data.text_field; lister_call_refresh_handler(app, &state->lister); + state->lister.data.text_field = dingus; } else{ copy(&state->lister.data.key_string, front_of_directory(state->lister.data.text_field)); @@ -274,9 +278,7 @@ CUSTOM_DOC("A lister mode command that handles input for the fixed sure to kill } } if (did_shortcut_key){ - lister_call_activate_handler(app, scratch, heap, - &view, state, - user_data, false); + lister_call_activate_handler(app, scratch, heap, &view, state, user_data, false); } } } diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index 58b6c6a4..dfa0046d 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -250,6 +250,16 @@ get_mouse_position_in_panel_space(Application_Links *app, Vec2_i32 file_region_p return(get_mouse_position_in_panel_space(get_mouse_state(app), file_region_p0)); } +static Vec2 +panel_space_from_view_space(Vec2 p, Vec2 scroll_p){ + return(p - scroll_p); +} + +static Vec2_i32 +panel_space_from_view_space(Vec2_i32 p, Vec2_i32 scroll_p){ + return(p - scroll_p); +} + //////////////////////////////// Lister_State global_lister_state_[16] = {}; diff --git a/4ed.cpp b/4ed.cpp index 26aacc52..c1d28c7d 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -947,7 +947,9 @@ App_Step_Sig(app_step){ models->animate_next_frame = false; // NOTE(allen): per-frame update of models state + begin_frame(target); models->target = target; + models->input = input; // NOTE(allen): OS clipboard event handling String clipboard = input->clipboard; @@ -1057,9 +1059,6 @@ App_Step_Sig(app_step){ end_temp_memory(temp); } - // NOTE(allen): init event context - models->input = input; - // NOTE(allen): input filter and simulated events if (models->input_filter != 0){ models->input_filter(&input->mouse); diff --git a/4ed_render_format.cpp b/4ed_render_format.cpp index e828584b..dc848c35 100644 --- a/4ed_render_format.cpp +++ b/4ed_render_format.cpp @@ -25,6 +25,11 @@ draw_change_clip(Render_Target *target, i32_Rect clip_box){ render_change_clip(target, clip_box); } +internal void +begin_frame(Render_Target *target){ + target->buffer.pos = 0; +} + internal void begin_render_section(Render_Target *target, System_Functions *system, i32 frame_index, f32 literal_dt, f32 animation_dt){ @@ -37,7 +42,6 @@ begin_render_section(Render_Target *target, System_Functions *system, clip.y1 = target->height; draw_push_clip(target, clip); - target->buffer.pos = 0; target->frame_index = frame_index; target->literal_dt = literal_dt; target->animation_dt = animation_dt; diff --git a/4ed_view.cpp b/4ed_view.cpp index b686521d..78e38286 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -1244,8 +1244,7 @@ view_get_render_cursor_target(System_Functions *system, View *view){ internal void view_call_render_caller(Models *models, Render_Target *target, View *view, - i32_Rect rect, Full_Cursor render_cursor, Range on_screen_range, Buffer_Render_Item *items, i32 item_count, - Render_Callback *core_render){ + i32_Rect rect, Full_Cursor render_cursor, Range on_screen_range, Buffer_Render_Item *items, i32 item_count, Render_Callback *core_render){ if (models->render_caller != 0){ View_ID view_id = view_get_id(&models->live_set, view); models->render_view = view; @@ -1257,11 +1256,12 @@ view_call_render_caller(Models *models, Render_Target *target, View *view, models->render_item_count = item_count; Render_Parameters params = {}; - params.view_id= view_id; + params.view_id = view_id; params.on_screen_range = on_screen_range; params.frame.index = target->frame_index; params.frame.literal_dt = target->literal_dt; params.frame.animation_dt = target->animation_dt; + params.buffer_region = rect; params.do_core_render = core_render; models->render_caller(&models->app_links, params); models->render_view = 0; diff --git a/4ed_view_ui.cpp b/4ed_view_ui.cpp index 59b54c4b..18daa5cf 100644 --- a/4ed_view_ui.cpp +++ b/4ed_view_ui.cpp @@ -9,30 +9,8 @@ // TOP -//////////////////////////////// - internal GUI_Scroll_Vars do_step_file_view(System_Functions *system, Models *models, View *view, i32_Rect rect, b32 is_active, f32 dt, GUI_Scroll_Vars scroll){ -#if 0 - i32 line_height = view->line_height; - - if (!view->hide_file_bar){ - i32_Rect top_bar_rect = {}; - top_bar_rect.x0 = rect.x0; - top_bar_rect.y0 = rect.y0; - top_bar_rect.x1 = rect.x1; - top_bar_rect.y1 = rect.y0 + line_height + 2; - rect.y0 = top_bar_rect.y1; - } - view->file_region = rect; - - i32 bar_count = 0; - for (Query_Slot *slot = view->query_set.used_slot; - slot != 0; - slot = slot->next, ++bar_count); - view->widget_height = (f32)bar_count*(view->line_height + 2); -#endif - Editing_File *file = view->file; // TODO(allen): do(eliminate the built in paste_effect) @@ -60,93 +38,11 @@ do_step_file_view(System_Functions *system, Models *models, View *view, i32_Rect //////////////////////////////// -internal void -intbar_draw_string(System_Functions *system, Render_Target *target, File_Bar *bar, String str, u32 char_color){ - Vec2 p = bar->pos + bar->text_shift; - bar->pos.x += draw_string(system, target, bar->font_id, str, p, char_color); -} - -internal void -draw_file_bar(System_Functions *system, Render_Target *target, View *view, Models *models, Editing_File *file, i32_Rect rect){ - File_Bar bar = {}; - Color_Table color_table = models->color_table; - - u32 back_color = color_table.vals[Stag_Bar]; - u32 base_color = color_table.vals[Stag_Base]; - u32 pop1_color = color_table.vals[Stag_Pop1]; - u32 pop2_color = color_table.vals[Stag_Pop2]; - - bar.rect = rect; - - if (target != 0){ - bar.font_id = file->settings.font_id; - bar.pos = V2(bar.rect.p0); - bar.text_shift = V2(0.f, 2.f); - - draw_rectangle(target, bar.rect, back_color); - - Assert(file != 0); - - intbar_draw_string(system, target, &bar, file->unique_name.name, base_color); - intbar_draw_string(system, target, &bar, lit(" -"), base_color); - - if (file->is_loading){ - intbar_draw_string(system, target, &bar, lit(" loading"), base_color); - } - else{ - File_Edit_Positions edit_pos = view_get_edit_pos(view); - Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(edit_pos.cursor_pos)); - - char bar_space[526]; - String bar_text = make_fixed_width_string(bar_space); - append_ss (&bar_text, lit(" L#")); - append_int_to_str(&bar_text, cursor.line); - append_ss (&bar_text, lit(" C#")); - append_int_to_str(&bar_text, cursor.character); - - append_ss(&bar_text, lit(" -")); - - if (file->settings.dos_write_mode){ - append_ss(&bar_text, lit(" dos")); - } - else{ - append_ss(&bar_text, lit(" nix")); - } - - intbar_draw_string(system, target, &bar, bar_text, base_color); - - - if (file->state.still_lexing){ - intbar_draw_string(system, target, &bar, lit(" parsing"), pop1_color); - } - - switch (file->state.dirty){ - case DirtyState_UnsavedChanges: - { - intbar_draw_string(system, target, &bar, lit(" *"), pop2_color); - }break; - - case DirtyState_UnloadedChanges: - { - intbar_draw_string(system, target, &bar, lit(" !"), pop2_color); - }break; - - case DirtyState_UnsavedChangesAndUnloadedChanges: - { - intbar_draw_string(system, target, &bar, lit(" *!"), pop2_color); - }break; - } - } - } -} - internal void do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Scroll_Vars *scroll, View *active, i32_Rect rect, b32 is_active, Render_Target *target){ Editing_File *file = view->file; Assert(file != 0); - draw_push_clip(target, rect); - if (!view->ui_mode){ if (file_is_ready(file)){ Rect_i32 file_region = view_get_file_region(models, view); @@ -158,7 +54,6 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc Range on_screen_range = {}; view_call_render_caller(models, target, view, rect, render_cursor, on_screen_range, 0, 0, dont_do_core_render); } - draw_pop_clip(target); } diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index d694b224..033e28e4 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -355,6 +355,18 @@ emit_bind(Partition *part, Mapping_Array *array, u32 keycode, u32 modifiers, cha } } +internal void +emit_bind_all_modifiers(Partition *part, Mapping_Array *mappings, u32 code, char *command){ + emit_bind(part, mappings, code, MDFR_NONE, command); + emit_bind(part, mappings, code, MDFR_CTRL, command); + emit_bind(part, mappings, code, MDFR_ALT , command); + emit_bind(part, mappings, code, MDFR_CMND, command); + emit_bind(part, mappings, code, MDFR_CTRL|MDFR_ALT , command); + emit_bind(part, mappings, code, MDFR_ALT |MDFR_CMND, command); + emit_bind(part, mappings, code, MDFR_CTRL|MDFR_CMND, command); + emit_bind(part, mappings, code, MDFR_CTRL|MDFR_ALT|MDFR_CMND, command); +} + internal void emit_bind_vanilla_keys(Partition *part, Mapping_Array *array, u32 modifiers, char *command){ Assert(array->current_mapping != 0); @@ -390,6 +402,7 @@ emit_bind_vanilla_keys(Partition *part, Mapping_Array *array, u32 modifiers, cha #define end_map(mp) emit_end_map(mp) #define inherit_map(pa,mp,mapid) emit_inherit_map(pa,mp, #mapid) #define bind(pa,mp,k,md,c) emit_bind(pa,mp, k, md, #c) +#define bind_all_modifiers(pa,mp,k,c) emit_bind_all_modifiers(pa,mp, k, #c) #define bind_vanilla_keys(pa,mp,md,c) emit_bind_vanilla_keys(pa,mp, md, #c) ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -614,7 +627,7 @@ generate_remapping_code_and_data(Partition *part){ bind(part, mappings, key_esc, MDFR_NONE, lister__quit); bind(part, mappings, '\n', MDFR_NONE, lister__activate); bind(part, mappings, '\t', MDFR_NONE, lister__activate); - bind(part, mappings, key_back , MDFR_NONE, lister__backspace_text_field); + bind_all_modifiers(part, mappings, key_back, lister__backspace_text_field); bind(part, mappings, key_up , MDFR_NONE, lister__move_up); bind(part, mappings, 'k' , MDFR_ALT , lister__move_up); bind(part, mappings, key_page_up , MDFR_NONE, lister__move_up); @@ -838,7 +851,7 @@ generate_remapping_code_and_data(Partition *part){ bind(part, mappings, key_esc, MDFR_NONE, lister__quit); bind(part, mappings, '\n', MDFR_NONE, lister__activate); bind(part, mappings, '\t', MDFR_NONE, lister__activate); - bind(part, mappings, key_back , MDFR_NONE, lister__backspace_text_field); + bind_all_modifiers(part, mappings, key_back, lister__backspace_text_field); bind(part, mappings, key_up , MDFR_NONE, lister__move_up); bind(part, mappings, key_page_up , MDFR_NONE, lister__move_up); bind(part, mappings, key_down , MDFR_NONE, lister__move_down);