diff --git a/4ed.cpp b/4ed.cpp index df5977fa..8201a52d 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -111,6 +111,9 @@ fill_hardcode_default_style(Color_Table color_table){ color_table.vals[Stag_Text_Cycle_2] = 0xFF00A000; color_table.vals[Stag_Text_Cycle_3] = 0xFF0030B0; color_table.vals[Stag_Text_Cycle_4] = 0xFFA0A000; + + color_table.vals[Stag_Line_Numbers_Back] = 0xFF101010; + color_table.vals[Stag_Line_Numbers_Text] = 0xFF404040; } internal void diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index b8b08247..83d44e82 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2533,7 +2533,7 @@ try_modify_face(Application_Links *app, Face_ID id, Face_Description *descriptio Coroutine *coroutine = (Coroutine*)app->current_coroutine; Assert(coroutine != 0); Co_Out *out = (Co_Out*)coroutine->out; - out->request = CoRequest_NewFontFace; + out->request = CoRequest_ModifyFace; out->face_description = description; out->face_id = id; coroutine_yield(coroutine); diff --git a/custom/4coder_base_commands.cpp b/custom/4coder_base_commands.cpp index 8c16e6e8..f657bb6d 100644 --- a/custom/4coder_base_commands.cpp +++ b/custom/4coder_base_commands.cpp @@ -139,7 +139,7 @@ CUSTOM_DOC("Deletes the text in the range between the cursor and the mark.") buffer_replace_range(app, buffer, range, string_u8_empty); } -static void +function void current_view_boundary_delete(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){ View_ID view = get_active_view(app, AccessOpen); Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); @@ -169,7 +169,7 @@ CUSTOM_DOC("Delete characters between the cursor position and the first alphanum #define backspace_word backspace_alpha_numeric_boundary #define delete_word delete_alpha_numeric_boundary -static void +function void current_view_snipe_delete(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){ View_ID view = get_active_view(app, AccessOpen); Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); @@ -450,7 +450,7 @@ CUSTOM_DOC("Moves the cursor one character to the right.") no_mark_snap_to_cursor_if_shift(app, view); } -static void +function void current_view_scan_move(Application_Links *app, Scan_Direction direction, Boundary_Function_List funcs){ View_ID view = get_active_view(app, AccessProtected); Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); @@ -700,7 +700,7 @@ CUSTOM_DOC("Decrease the size of the face used by the current buffer.") CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size) CUSTOM_DOC("Reads the state of the mouse wheel and uses it to either increase or decrease the face size.") { - static u64 next_resize_time = 0; + local_persist u64 next_resize_time = 0; u64 now = system_now_time(); if (now >= next_resize_time){ next_resize_time = now + 50*1000; @@ -781,7 +781,7 @@ CUSTOM_DOC("Queries the user for a number, and jumps the cursor to the correspon CUSTOM_COMMAND_SIG(search); CUSTOM_COMMAND_SIG(reverse_search); -static void +function void isearch__update_highlight(Application_Links *app, View_ID view, Range_i64 range){ view_set_highlight_range(app, view, range); view_set_cursor_and_preferred_x(app, view, seek_pos(range.start)); @@ -1091,7 +1091,7 @@ CUSTOM_DOC("Queries the user for a needle and string. Replaces all occurences of global_history_edit_group_end(app); } -static void +function void query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i64 pos, String_Const_u8 r, String_Const_u8 w){ i64 new_pos = 0; seek_string_forward(app, buffer_id, pos - 1, 0, r, &new_pos); @@ -1217,7 +1217,7 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur //////////////////////////////// -static void +function void save_all_dirty_buffers_with_postfix(Application_Links *app, String_Const_u8 postfix){ Scratch_Block scratch(app); for (Buffer_ID buffer = get_buffer_next(app, 0, AccessOpen); @@ -1242,7 +1242,7 @@ CUSTOM_DOC("Saves all buffers marked dirty (showing the '*' indicator).") save_all_dirty_buffers_with_postfix(app, empty); } -static void +function void delete_file_base(Application_Links *app, String_Const_u8 file_name, Buffer_ID buffer_id){ String_Const_u8 path = string_remove_last_folder(file_name); Scratch_Block scratch(app); @@ -1456,7 +1456,7 @@ CUSTOM_DOC("Delete the line the on which the cursor sits.") //////////////////////////////// -static b32 +function b32 get_cpp_matching_file(Application_Links *app, Buffer_ID buffer, Buffer_ID *buffer_out){ b32 result = false; Scratch_Block scratch(app); @@ -1656,7 +1656,7 @@ CUSTOM_COMMAND_SIG(multi_paste){ } } -static Range_i64 +function Range_i64 multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 paste_count, b32 old_to_new){ Scratch_Block scratch(app); @@ -1713,7 +1713,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 pas return(finish_range); } -static void +function void multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 clip_count){ View_ID view = get_active_view(app, AccessOpen); i64 pos = view_get_cursor_pos(app, view); diff --git a/custom/4coder_base_types.cpp b/custom/4coder_base_types.cpp index 22c90389..1daf4ed7 100644 --- a/custom/4coder_base_types.cpp +++ b/custom/4coder_base_types.cpp @@ -2433,13 +2433,10 @@ rect_union(Rect_f32 a, Rect_f32 b){ return(a); } -#define intersection_of rect_intersect -#define union_of rect_union - //////////////////////////////// internal Rect_f32_Pair -rect_split_top_bottom(Rect_f32 rect, f32 y){ +rect_split_top_bottom__inner(Rect_f32 rect, f32 y){ y = clamp(rect.y0, y, rect.y1); Rect_f32_Pair pair = {}; pair.a = Rf32(rect.x0, rect.y0, rect.x1, y ); @@ -2448,7 +2445,7 @@ rect_split_top_bottom(Rect_f32 rect, f32 y){ } internal Rect_f32_Pair -rect_split_left_right(Rect_f32 rect, f32 x){ +rect_split_left_right__inner(Rect_f32 rect, f32 x){ x = clamp(rect.x0, x, rect.x1); Rect_f32_Pair pair = {}; pair.a = Rf32(rect.x0, rect.y0, x , rect.y1); @@ -2456,24 +2453,34 @@ rect_split_left_right(Rect_f32 rect, f32 x){ return(pair); } +internal Rect_f32_Pair +rect_split_top_bottom(Rect_f32 rect, f32 y){ + return(rect_split_top_bottom__inner(rect, rect.y0 + y)); +} + +internal Rect_f32_Pair +rect_split_left_right(Rect_f32 rect, f32 x){ + return(rect_split_left_right__inner(rect, rect.x0 + x)); +} + internal Rect_f32_Pair rect_split_top_bottom_neg(Rect_f32 rect, f32 y){ - return(rect_split_top_bottom(rect, rect.y1 - y)); + return(rect_split_top_bottom__inner(rect, rect.y1 - y)); } internal Rect_f32_Pair rect_split_left_right_neg(Rect_f32 rect, f32 x){ - return(rect_split_left_right(rect, rect.x1 - x)); + return(rect_split_left_right__inner(rect, rect.x1 - x)); } internal Rect_f32_Pair rect_split_top_bottom_lerp(Rect_f32 rect, f32 t){ - return(rect_split_top_bottom(rect, lerp(rect.y0, t, rect.y1))); + return(rect_split_top_bottom__inner(rect, lerp(rect.y0, t, rect.y1))); } internal Rect_f32_Pair rect_split_left_right_lerp(Rect_f32 rect, f32 t){ - return(rect_split_left_right(rect, lerp(rect.x0, t, rect.x1))); + return(rect_split_left_right__inner(rect, lerp(rect.x0, t, rect.x1))); } //////////////////////////////// diff --git a/custom/4coder_config.cpp b/custom/4coder_config.cpp index 8b894bfa..e3d0b087 100644 --- a/custom/4coder_config.cpp +++ b/custom/4coder_config.cpp @@ -4,7 +4,7 @@ // TOP -internal String_Const_u8_Array +function String_Const_u8_Array parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){ i32 count = 0; for (umem i = 0; i < str.size; i += 1){ @@ -32,7 +32,7 @@ parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){ //////////////////////////////// -internal Error_Location +function Error_Location get_error_location(u8 *base, u8 *pos){ Error_Location location = {}; location.line_number = 1; @@ -51,7 +51,7 @@ get_error_location(u8 *base, u8 *pos){ return(location); } -internal String_Const_u8 +function String_Const_u8 config_stringize_errors(Arena *arena, Config *parsed){ String_Const_u8 result = {}; if (parsed->errors.first != 0){ @@ -70,7 +70,7 @@ config_stringize_errors(Arena *arena, Config *parsed){ //////////////////////////////// -internal void +function void config_parser__advance_to_next(Config_Parser *ctx){ Token *t = ctx->token; Token *e = ctx->end; @@ -81,7 +81,7 @@ config_parser__advance_to_next(Config_Parser *ctx){ ctx->token = t; } -internal Config_Parser +function Config_Parser make_config_parser(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ Config_Parser ctx = {}; ctx.start = array.tokens; @@ -94,7 +94,7 @@ make_config_parser(Arena *arena, String_Const_u8 file_name, String_Const_u8 data return(ctx); } -internal b32 +function b32 config_parser__recognize_base_token(Config_Parser *ctx, Token_Base_Kind kind){ b32 result = false; if (ctx->start <= ctx->token && ctx->token < ctx->end){ @@ -106,7 +106,7 @@ config_parser__recognize_base_token(Config_Parser *ctx, Token_Base_Kind kind){ return(result); } -internal b32 +function b32 config_parser__recognize_token(Config_Parser *ctx, Token_Cpp_Kind kind){ b32 result = false; if (ctx->start <= ctx->token && ctx->token < ctx->end){ @@ -118,7 +118,7 @@ config_parser__recognize_token(Config_Parser *ctx, Token_Cpp_Kind kind){ return(result); } -internal b32 +function b32 config_parser__recognize_boolean(Config_Parser *ctx){ b32 result = false; Token *token = ctx->token; @@ -129,7 +129,7 @@ config_parser__recognize_boolean(Config_Parser *ctx){ return(result); } -internal String_Const_u8 +function String_Const_u8 config_parser__get_lexeme(Config_Parser *ctx){ String_Const_u8 lexeme = {}; Token *token = ctx->token; @@ -139,7 +139,7 @@ config_parser__get_lexeme(Config_Parser *ctx){ return(lexeme); } -internal Config_Integer +function Config_Integer config_parser__get_int(Config_Parser *ctx){ Config_Integer config_integer = {}; String_Const_u8 str = config_parser__get_lexeme(ctx); @@ -161,19 +161,19 @@ config_parser__get_int(Config_Parser *ctx){ return(config_integer); } -internal b32 +function b32 config_parser__get_boolean(Config_Parser *ctx){ String_Const_u8 str = config_parser__get_lexeme(ctx); return(string_match(str, string_u8_litexpr("true"))); } -internal b32 +function b32 config_parser__recognize_text(Config_Parser *ctx, String_Const_u8 text){ String_Const_u8 lexeme = config_parser__get_lexeme(ctx); return(lexeme.str != 0 && string_match(lexeme, text)); } -internal b32 +function b32 config_parser__match_token(Config_Parser *ctx, Token_Cpp_Kind kind){ b32 result = config_parser__recognize_token(ctx, kind); if (result){ @@ -182,7 +182,7 @@ config_parser__match_token(Config_Parser *ctx, Token_Cpp_Kind kind){ return(result); } -internal b32 +function b32 config_parser__match_text(Config_Parser *ctx, String_Const_u8 text){ b32 result = config_parser__recognize_text(ctx, text); if (result){ @@ -193,15 +193,15 @@ config_parser__match_text(Config_Parser *ctx, String_Const_u8 text){ #define config_parser__match_text_lit(c,s) config_parser__match_text((c), string_u8_litexpr(s)) -internal Config *config_parser__config (Config_Parser *ctx); -internal i32 *config_parser__version (Config_Parser *ctx); -internal Config_Assignment *config_parser__assignment(Config_Parser *ctx); -internal Config_LValue *config_parser__lvalue (Config_Parser *ctx); -internal Config_RValue *config_parser__rvalue (Config_Parser *ctx); -internal Config_Compound *config_parser__compound (Config_Parser *ctx); -internal Config_Compound_Element *config_parser__element (Config_Parser *ctx); +function Config *config_parser__config (Config_Parser *ctx); +function i32 *config_parser__version (Config_Parser *ctx); +function Config_Assignment *config_parser__assignment(Config_Parser *ctx); +function Config_LValue *config_parser__lvalue (Config_Parser *ctx); +function Config_RValue *config_parser__rvalue (Config_Parser *ctx); +function Config_Compound *config_parser__compound (Config_Parser *ctx); +function Config_Compound_Element *config_parser__element (Config_Parser *ctx); -internal Config* +function Config* text_data_and_token_array_to_parse_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ Temp_Memory restore_point = begin_temp(arena); Config_Parser ctx = make_config_parser(arena, file_name, data, array); @@ -213,7 +213,7 @@ text_data_and_token_array_to_parse_data(Arena *arena, String_Const_u8 file_name, } // TODO(allen): Move to string library -internal Config_Error* +function Config_Error* config_error_push(Arena *arena, Config_Error_List *list, String_Const_u8 file_name, u8 *pos, char *error_text){ Config_Error *error = push_array(arena, Config_Error, 1); zdll_push_back(list->first, list->last, error); @@ -224,22 +224,22 @@ config_error_push(Arena *arena, Config_Error_List *list, String_Const_u8 file_na return(error); } -internal u8* +function u8* config_parser__get_pos(Config_Parser *ctx){ return(ctx->data.str + ctx->token->pos); } -internal void +function void config_parser__log_error_pos(Config_Parser *ctx, u8 *pos, char *error_text){ config_error_push(ctx->arena, &ctx->errors, ctx->file_name, pos, error_text); } -internal void +function void config_parser__log_error(Config_Parser *ctx, char *error_text){ config_parser__log_error_pos(ctx, config_parser__get_pos(ctx), error_text); } -internal Config* +function Config* config_parser__config(Config_Parser *ctx){ i32 *version = config_parser__version(ctx); @@ -266,7 +266,7 @@ config_parser__config(Config_Parser *ctx){ return(config); } -internal void +function void config_parser__recover_parse(Config_Parser *ctx){ for (;;){ if (config_parser__match_token(ctx, TokenCppKind_Semicolon)){ @@ -279,7 +279,7 @@ config_parser__recover_parse(Config_Parser *ctx){ } } -internal i32* +function i32* config_parser__version(Config_Parser *ctx){ require(config_parser__match_text_lit(ctx, "version")); @@ -315,7 +315,7 @@ config_parser__version(Config_Parser *ctx){ return(ptr); } -internal Config_Assignment* +function Config_Assignment* config_parser__assignment(Config_Parser *ctx){ u8 *pos = config_parser__get_pos(ctx); @@ -357,7 +357,7 @@ config_parser__assignment(Config_Parser *ctx){ return(assignment); } -internal Config_LValue* +function Config_LValue* config_parser__lvalue(Config_Parser *ctx){ require(config_parser__recognize_token(ctx, TokenCppKind_Identifier)); String_Const_u8 identifier = config_parser__get_lexeme(ctx); @@ -378,7 +378,7 @@ config_parser__lvalue(Config_Parser *ctx){ return(lvalue); } -internal Config_RValue* +function Config_RValue* config_parser__rvalue(Config_Parser *ctx){ Config_RValue *rvalue = 0; if (config_parser__recognize_token(ctx, TokenCppKind_Identifier)){ @@ -436,7 +436,7 @@ config_parser__rvalue(Config_Parser *ctx){ return(rvalue); } -internal void +function void config_parser__compound__check(Config_Parser *ctx, Config_Compound *compound){ b32 implicit_index_allowed = true; for (Config_Compound_Element *node = compound->first; @@ -452,7 +452,7 @@ config_parser__compound__check(Config_Parser *ctx, Config_Compound *compound){ } } -internal Config_Compound* +function Config_Compound* config_parser__compound(Config_Parser *ctx){ Config_Compound_Element *first = 0; Config_Compound_Element *last = 0; @@ -484,7 +484,7 @@ config_parser__compound(Config_Parser *ctx){ return(compound); } -internal Config_Compound_Element* +function Config_Compound_Element* config_parser__element(Config_Parser *ctx){ Config_Layout layout = {}; layout.pos = config_parser__get_pos(ctx); @@ -516,14 +516,14 @@ config_parser__element(Config_Parser *ctx){ //////////////////////////////// -internal Config_Error* +function Config_Error* config_add_error(Arena *arena, Config *config, u8 *pos, char *error_text){ return(config_error_push(arena, &config->errors, config->file_name, pos, error_text)); } //////////////////////////////// -internal Config_Assignment* +function Config_Assignment* config_lookup_assignment(Config *config, String_Const_u8 var_name, i32 subscript){ Config_Assignment *assignment = 0; for (assignment = config->first; @@ -537,10 +537,10 @@ config_lookup_assignment(Config *config, String_Const_u8 var_name, i32 subscript return(assignment); } -internal Config_Get_Result +function Config_Get_Result config_var(Config *config, String_Const_u8 var_name, i32 subscript); -internal Config_Get_Result +function Config_Get_Result config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RValue *r){ Config_Get_Result result = {}; if (r != 0 && !assignment->visited){ @@ -585,7 +585,7 @@ config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RVa return(result); } -static Config_Get_Result +function Config_Get_Result config_var(Config *config, String_Const_u8 var_name, i32 subscript){ Config_Get_Result result = {}; Config_Assignment *assignment = config_lookup_assignment(config, var_name, subscript); @@ -595,7 +595,7 @@ config_var(Config *config, String_Const_u8 var_name, i32 subscript){ return(result); } -static Config_Get_Result +function Config_Get_Result config_compound_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index){ Config_Get_Result result = {}; i32 implicit_index = 0; @@ -638,31 +638,31 @@ config_compound_member(Config *config, Config_Compound *compound, String_Const_u return(result); } -static Config_Iteration_Step_Result +function Config_Iteration_Step_Result typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index); -static i32 +function i32 typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type); -static Config_Get_Result_List +function Config_Get_Result_List typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type); #define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a)) //////////////////////////////// -static b32 +function b32 config_has_var(Config *config, String_Const_u8 var_name, i32 subscript){ Config_Get_Result result = config_var(config, var_name, subscript); return(result.success && result.type == ConfigRValueType_NoType); } -static b32 +function b32 config_has_var(Config *config, char *var_name, i32 subscript){ return(config_has_var(config, SCu8(var_name), subscript)); } -static b32 +function b32 config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = (result.success && result.type == ConfigRValueType_Boolean); @@ -671,26 +671,30 @@ config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* va } return(success); } -static b32 +function b32 config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b8 *var_out){ b32 temp = false; b32 success = config_bool_var(config, var_name, subscript, &temp); - *var_out = (temp != false); + if (success){ + *var_out = (temp != false); + } return(success); } -static b32 +function b32 config_bool_var(Config *config, char *var_name, i32 subscript, b32* var_out){ return(config_bool_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_bool_var(Config *config, char* var_name, i32 subscript, b8 *var_out){ b32 temp = false; b32 success = config_bool_var(config, SCu8(var_name), subscript, &temp); - *var_out = (temp != false); + if (success){ + *var_out = (temp != false); + } return(success); } -static b32 +function b32 config_int_var(Config *config, String_Const_u8 var_name, i32 subscript, i32* var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = result.success && result.type == ConfigRValueType_Integer; @@ -700,12 +704,12 @@ config_int_var(Config *config, String_Const_u8 var_name, i32 subscript, i32* var return(success); } -static b32 +function b32 config_int_var(Config *config, char *var_name, i32 subscript, i32* var_out){ return(config_int_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_uint_var(Config *config, String_Const_u8 var_name, i32 subscript, u32* var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = result.success && result.type == ConfigRValueType_Integer; @@ -715,12 +719,12 @@ config_uint_var(Config *config, String_Const_u8 var_name, i32 subscript, u32* va return(success); } -static b32 +function b32 config_uint_var(Config *config, char *var_name, i32 subscript, u32* var_out){ return(config_uint_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = result.success && result.type == ConfigRValueType_String; @@ -730,12 +734,12 @@ config_string_var(Config *config, String_Const_u8 var_name, i32 subscript, Strin return(success); } -static b32 +function b32 config_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out){ return(config_string_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = (result.success && result.type == ConfigRValueType_String); @@ -748,12 +752,12 @@ config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript return(success); } -static b32 +function b32 config_placed_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ return(config_placed_string_var(config, SCu8(var_name), subscript, var_out, space, space_size)); } -static b32 +function b32 config_char_var(Config *config, String_Const_u8 var_name, i32 subscript, char* var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = result.success && result.type == ConfigRValueType_Character; @@ -763,12 +767,12 @@ config_char_var(Config *config, String_Const_u8 var_name, i32 subscript, char* v return(success); } -static b32 +function b32 config_char_var(Config *config, char *var_name, i32 subscript, char* var_out){ return(config_char_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_compound_var(Config *config, String_Const_u8 var_name, i32 subscript, Config_Compound** var_out){ Config_Get_Result result = config_var(config, var_name, subscript); b32 success = result.success && result.type == ConfigRValueType_Compound; @@ -778,12 +782,12 @@ config_compound_var(Config *config, String_Const_u8 var_name, i32 subscript, Con return(success); } -static b32 +function b32 config_compound_var(Config *config, char *var_name, i32 subscript, Config_Compound** var_out){ return(config_compound_var(config, SCu8(var_name), subscript, var_out)); } -static b32 +function b32 config_compound_has_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -791,13 +795,13 @@ config_compound_has_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_has_member(Config *config, Config_Compound *compound, char *var_name, i32 index){ return(config_compound_has_member(config, compound, SCu8(var_name), index)); } -static b32 +function b32 config_compound_bool_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, b32* var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -808,13 +812,13 @@ config_compound_bool_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_bool_member(Config *config, Config_Compound *compound, char *var_name, i32 index, b32* var_out){ return(config_compound_bool_member(config, compound, SCu8(var_name), index, var_out)); } -static b32 +function b32 config_compound_int_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, i32* var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -825,13 +829,13 @@ config_compound_int_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_int_member(Config *config, Config_Compound *compound, char *var_name, i32 index, i32* var_out){ return(config_compound_int_member(config, compound, SCu8(var_name), index, var_out)); } -static b32 +function b32 config_compound_uint_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, u32* var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -842,13 +846,13 @@ config_compound_uint_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_uint_member(Config *config, Config_Compound *compound, char *var_name, i32 index, u32* var_out){ return(config_compound_uint_member(config, compound, SCu8(var_name), index, var_out)); } -static b32 +function b32 config_compound_string_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, String_Const_u8* var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -859,13 +863,13 @@ config_compound_string_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_string_member(Config *config, Config_Compound *compound, char *var_name, i32 index, String_Const_u8* var_out){ return(config_compound_string_member(config, compound, SCu8(var_name), index, var_out)); } -static b32 +function b32 config_compound_placed_string_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -879,13 +883,13 @@ config_compound_placed_string_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_placed_string_member(Config *config, Config_Compound *compound, char *var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ return(config_compound_placed_string_member(config, compound, SCu8(var_name), index, var_out, space, space_size)); } -static b32 +function b32 config_compound_char_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, char* var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -896,13 +900,13 @@ config_compound_char_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_char_member(Config *config, Config_Compound *compound, char *var_name, i32 index, char* var_out){ return(config_compound_char_member(config, compound, SCu8(var_name), index, var_out)); } -static b32 +function b32 config_compound_compound_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index, Config_Compound** var_out){ Config_Get_Result result = config_compound_member(config, compound, var_name, index); @@ -913,19 +917,19 @@ config_compound_compound_member(Config *config, Config_Compound *compound, return(success); } -static b32 +function b32 config_compound_compound_member(Config *config, Config_Compound *compound, char *var_name, i32 index, Config_Compound** var_out){ return(config_compound_compound_member(config, compound, SCu8(var_name), index, var_out)); } -static Iteration_Step_Result +function Iteration_Step_Result typed_has_array_iteration_step(Config *config, Config_Compound *compound, i32 index){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType, index); return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 index, b32* var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index); b32 success = (result.step == Iteration_Good); @@ -935,7 +939,7 @@ typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 i return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_int_array_iteration_step(Config *config, Config_Compound *compound, i32 index, i32* var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); b32 success = (result.step == Iteration_Good); @@ -945,7 +949,7 @@ typed_int_array_iteration_step(Config *config, Config_Compound *compound, i32 in return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_uint_array_iteration_step(Config *config, Config_Compound *compound, i32 index, u32* var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); b32 success = (result.step == Iteration_Good); @@ -955,7 +959,7 @@ typed_uint_array_iteration_step(Config *config, Config_Compound *compound, i32 i return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); b32 success = (result.step == Iteration_Good); @@ -965,7 +969,7 @@ typed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); b32 success = (result.step == Iteration_Good); @@ -978,7 +982,7 @@ typed_placed_string_array_iteration_step(Config *config, Config_Compound *compou return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_char_array_iteration_step(Config *config, Config_Compound *compound, i32 index, char* var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Character, index); b32 success = (result.step == Iteration_Good); @@ -988,7 +992,7 @@ typed_char_array_iteration_step(Config *config, Config_Compound *compound, i32 i return(result.step); } -static Iteration_Step_Result +function Iteration_Step_Result typed_compound_array_iteration_step(Config *config, Config_Compound *compound, i32 index, Config_Compound** var_out){ Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Compound, index); b32 success = (result.step == Iteration_Good); @@ -998,85 +1002,85 @@ typed_compound_array_iteration_step(Config *config, Config_Compound *compound, i return(result.step); } -static i32 +function i32 typed_bool_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_Boolean); return(count); } -static i32 +function i32 typed_int_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_Integer); return(count); } -static i32 +function i32 typed_float_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_Float); return(count); } -static i32 +function i32 typed_string_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_String); return(count); } -static i32 +function i32 typed_character_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_Character); return(count); } -static i32 +function i32 typed_compound_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_Compound); return(count); } -static i32 +function i32 typed_no_type_array_get_count(Config *config, Config_Compound *compound){ i32 count = typed_array_get_count(config, compound, ConfigRValueType_NoType); return(count); } -static Config_Get_Result_List +function Config_Get_Result_List typed_bool_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_int_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Integer); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_float_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Float); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_string_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_String); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_character_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Character); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_compound_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Compound); return(list); } -static Config_Get_Result_List +function Config_Get_Result_List typed_no_type_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_NoType); return(list); @@ -1084,7 +1088,7 @@ typed_no_type_array_reference_list(Arena *arena, Config *config, Config_Compound //////////////////////////////// -static Config_Iteration_Step_Result +function Config_Iteration_Step_Result typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index){ Config_Iteration_Step_Result result = {}; result.step = Iteration_Quit; @@ -1101,7 +1105,7 @@ typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RVa return(result); } -static i32 +function i32 typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){ i32 count = 0; for (i32 i = 0;; ++i){ @@ -1117,7 +1121,7 @@ typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_T return(count); } -static Config_Get_Result_List +function Config_Get_Result_List typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type){ Config_Get_Result_List list = {}; for (i32 i = 0;; ++i){ @@ -1138,7 +1142,7 @@ typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compou //////////////////////////////// -static void +function void change_mode(Application_Links *app, String_Const_u8 mode){ fcoder_mode = FCoderMode_Original; if (string_match(mode, string_u8_litexpr("4coder"))){ @@ -1154,13 +1158,13 @@ change_mode(Application_Links *app, String_Const_u8 mode){ //////////////////////////////// -static Token_Array +function Token_Array token_array_from_text(Arena *arena, String_Const_u8 data){ Token_List list = lex_full_input_cpp(arena, data); return(token_array_from_list(arena, &list)); } -static Config* +function Config* text_data_to_parsed_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data){ Config *parsed = 0; Temp_Memory restore_point = begin_temp(arena); @@ -1176,7 +1180,7 @@ text_data_to_parsed_data(Arena *arena, String_Const_u8 file_name, String_Const_u //////////////////////////////// -static void +function void config_init_default(Config_Data *config){ config->user_name = SCu8(config->user_name_space, (umem)0); @@ -1186,7 +1190,8 @@ config_init_default(Config_Data *config){ config->use_scroll_bars = false; config->use_file_bars = true; - config->use_line_highlight = true; + config->use_error_highlight = true; + config->use_jump_highlight = true; config->use_scope_highlight = true; config->use_paren_helper = true; config->use_comment_keyword = true; @@ -1227,7 +1232,7 @@ config_init_default(Config_Data *config){ config->lalt_lctrl_is_altgr = false; } -static Config* +function Config* config_parse__data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Config_Data *config){ config_init_default(config); @@ -1250,7 +1255,8 @@ config_parse__data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data config_bool_var(parsed, "use_scroll_bars", 0, &config->use_scroll_bars); config_bool_var(parsed, "use_file_bars", 0, &config->use_file_bars); - config_bool_var(parsed, "use_line_highlight", 0, &config->use_line_highlight); + config_bool_var(parsed, "use_error_highlight", 0, &config->use_error_highlight); + config_bool_var(parsed, "use_jump_highlight", 0, &config->use_jump_highlight); 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); @@ -1299,7 +1305,7 @@ config_parse__data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data return(parsed); } -static Config* +function Config* config_parse__file_handle(Arena *arena, String_Const_u8 file_name, FILE *file, Config_Data *config){ Config *parsed = 0; Data data = dump_file_handle(arena, file); @@ -1312,7 +1318,7 @@ config_parse__file_handle(Arena *arena, String_Const_u8 file_name, FILE *file, C return(parsed); } -static Config* +function Config* config_parse__file_name(Application_Links *app, Arena *arena, char *file_name, Config_Data *config){ Config *parsed = 0; b32 success = false; @@ -1332,14 +1338,14 @@ config_parse__file_name(Application_Links *app, Arena *arena, char *file_name, C } #if 0 -static void +function void init_theme_zero(Theme *theme){ for (i32 i = 0; i < Stag_COUNT; ++i){ theme->colors[i] = 0; } } -static Config* +function Config* theme_parse__data(Partition *arena, String file_name, String data, Theme_Data *theme){ theme->name = make_fixed_width_string(theme->space); copy(&theme->name, "unnamed"); @@ -1362,7 +1368,7 @@ theme_parse__data(Partition *arena, String file_name, String data, Theme_Data *t return(parsed); } -static Config* +function Config* theme_parse__file_handle(Partition *arena, String file_name, FILE *file, Theme_Data *theme){ String data = dump_file_handle(arena, file); Config *parsed = 0; @@ -1372,7 +1378,7 @@ theme_parse__file_handle(Partition *arena, String file_name, FILE *file, Theme_D return(parsed); } -static Config* +function Config* theme_parse__file_name(Application_Links *app, Partition *arena, char *file_name, Theme_Data *theme){ Config *parsed = 0; @@ -1396,23 +1402,23 @@ theme_parse__file_name(Application_Links *app, Partition *arena, //////////////////////////////// -static void +function void config_feedback_bool(Arena *arena, List_String_Const_u8 *list, char *name, b32 val){ string_list_pushf(arena, list, "%s = %s;\n", name, (char*)(val?"true":"false")); } -static void +function void config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8 val){ val.size = clamp_bot(0, val.size); string_list_pushf(arena, list, "%s = \"%.*s\";\n", name, string_expand(val)); } -static void +function void config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, char *val){ string_list_pushf(arena, list, "%s = \"%s\";\n", name, val); } -static void +function void config_feedback_extension_list(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8_Array *extensions){ string_list_pushf(arena, list, "%s = \"", name); for (i32 i = 0; i < extensions->count; ++i){ @@ -1422,14 +1428,14 @@ config_feedback_extension_list(Arena *arena, List_String_Const_u8 *list, char *n string_list_push_u8_lit(arena, list, "\";\n"); } -static void +function void config_feedback_int(Arena *arena, List_String_Const_u8 *list, char *name, i32 val){ string_list_pushf(arena, list, "%s = %d;\n", name, val); } //////////////////////////////// -static void +function void load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *config, i32 override_font_size, b32 override_hinting){ Scratch_Block scratch(app); @@ -1459,7 +1465,8 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con config_feedback_bool(scratch, &list, "use_scroll_bars", config->use_scroll_bars); config_feedback_bool(scratch, &list, "use_file_bars", config->use_file_bars); - config_feedback_bool(scratch, &list, "use_line_highlight", config->use_line_highlight); + config_feedback_bool(scratch, &list, "use_error_highlight", config->use_error_highlight); + config_feedback_bool(scratch, &list, "use_jump_highlight", config->use_jump_highlight); config_feedback_bool(scratch, &list, "use_scope_highlight", config->use_scope_highlight); config_feedback_bool(scratch, &list, "use_paren_helper", config->use_paren_helper); config_feedback_bool(scratch, &list, "use_comment_keyword", config->use_comment_keyword); @@ -1501,14 +1508,9 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con // Apply config change_mode(app, config->mode); - highlight_line_at_cursor = config->use_line_highlight; - do_matching_enclosure_highlight = config->use_scope_highlight; - do_matching_paren_highlight = config->use_paren_helper; - do_colored_comment_keywords = config->use_comment_keyword; global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr); //change_theme(app, config->default_theme_name.str, config->default_theme_name.size); - highlight_line_at_cursor = config->highlight_line_at_cursor; Face_Description description = {}; description.font.file_name = config->default_font_name; @@ -1528,7 +1530,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con } #if 0 -static void +function void load_theme_file_into_live_set(Application_Links *app, Partition *scratch, char *file_name){ Temp_Memory temp = begin_temp_memory(scratch); Theme_Data theme = {}; @@ -1539,7 +1541,7 @@ load_theme_file_into_live_set(Application_Links *app, Partition *scratch, char * create_theme(app, &theme.theme, theme.name.str, theme.name.size); } -static void +function void load_folder_of_themes_into_live_set(Application_Links *app, Partition *scratch, char *folder_name){ char path_space[512]; diff --git a/custom/4coder_config.h b/custom/4coder_config.h index 08071205..71983aa6 100644 --- a/custom/4coder_config.h +++ b/custom/4coder_config.h @@ -190,7 +190,8 @@ struct Config_Data{ b8 use_scroll_bars; b8 use_file_bars; - b8 use_line_highlight; + b8 use_error_highlight; + b8 use_jump_highlight; b8 use_scope_highlight; b8 use_paren_helper; b8 use_comment_keyword; diff --git a/custom/4coder_default_framework.cpp b/custom/4coder_default_framework.cpp index ab87ff89..e487fda5 100644 --- a/custom/4coder_default_framework.cpp +++ b/custom/4coder_default_framework.cpp @@ -34,19 +34,26 @@ lock_jump_buffer(Application_Links *app, Buffer_ID buffer_id){ lock_jump_buffer(app, buffer_name); } +function Buffer_ID +get_locked_jump_buffer(Application_Links *app){ + Buffer_ID result = 0; + if (locked_buffer.size > 0){ + result = get_buffer_by_name(app, locked_buffer, AccessAll); + } + if (result == 0){ + unlock_jump_buffer(); + } + return(result); +} + static View_ID get_view_for_locked_jump_buffer(Application_Links *app){ - View_ID view = 0; - if (locked_buffer.size > 0){ - Buffer_ID buffer = get_buffer_by_name(app, locked_buffer, AccessAll); - if (buffer != 0){ - view = get_first_view_with_buffer(app, buffer); - } - else{ - unlock_jump_buffer(); - } + View_ID result = 0; + Buffer_ID buffer = get_locked_jump_buffer(app); + if (buffer != 0){ + result = get_first_view_with_buffer(app, buffer); } - return(view); + return(result); } //////////////////////////////// @@ -321,19 +328,19 @@ CUSTOM_DOC("Sets the edit mode to Notepad like.") CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor) CUSTOM_DOC("Toggles the line highlight at the cursor.") { - highlight_line_at_cursor = !highlight_line_at_cursor; + global_config.highlight_line_at_cursor = !global_config.highlight_line_at_cursor; } CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes) CUSTOM_DOC("In code files scopes surrounding the cursor are highlighted with distinguishing colors.") { - do_matching_enclosure_highlight = !do_matching_enclosure_highlight; + global_config.use_scope_highlight = !global_config.use_scope_highlight; } CUSTOM_COMMAND_SIG(toggle_paren_matching_helper) CUSTOM_DOC("In code files matching parentheses pairs are colored with distinguishing colors.") { - do_matching_paren_highlight = !do_matching_paren_highlight; + global_config.use_paren_helper = !global_config.use_paren_helper; } CUSTOM_COMMAND_SIG(toggle_fullscreen) diff --git a/custom/4coder_default_framework_variables.cpp b/custom/4coder_default_framework_variables.cpp index e2b310fb..96e55847 100644 --- a/custom/4coder_default_framework_variables.cpp +++ b/custom/4coder_default_framework_variables.cpp @@ -51,11 +51,6 @@ global u8 out_buffer_space[1024]; global u8 command_space[1024]; global char hot_directory_space[1024]; - -global b32 highlight_line_at_cursor = true; -global b32 do_matching_enclosure_highlight = true; -global b32 do_matching_paren_highlight = true; -global b32 do_colored_comment_keywords = true; global b32 suppressing_mouse = false; global b32 show_fps_hud = false; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index b571318d..8bc7cea0 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -128,93 +128,6 @@ CUSTOM_DOC("Input consumption loop for default view behavior") } } -internal Range_i64_Array -get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 pos, u32 flags){ - Range_i64_Array array = {}; - i32 max = 100; - array.ranges = push_array(arena, Range_i64, max); - for (;;){ - Range_i64 range = {}; - if (find_surrounding_nest(app, buffer, pos, flags, &range)){ - array.ranges[array.count] = range; - array.count += 1; - pos = range.first; - if (array.count >= max){ - break; - } - } - else{ - break; - } - } - return(array); -} - -typedef i32 Range_Highlight_Kind; -enum{ - RangeHighlightKind_LineHighlight, - RangeHighlightKind_CharacterHighlight, -}; - -internal void -draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID buffer, - i64 pos, u32 flags, Range_Highlight_Kind kind, - int_color *back_colors, int_color *fore_colors, i32 color_count){ - Scratch_Block scratch(app); - Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags); - - i32 color_index = 0; - for (i32 i = ranges.count - 1; i >= 0; i -= 1){ - Range_i64 range = ranges.ranges[i]; - if (kind == RangeHighlightKind_LineHighlight){ - Range_i64 r[2] = {}; - if (i > 0){ - Range_i64 inner_range = ranges.ranges[i - 1]; - Range_i64 lines = get_line_range_from_pos_range(app, buffer, range); - Range_i64 inner_lines = get_line_range_from_pos_range(app, buffer, inner_range); - inner_lines.min = clamp_bot(lines.min, inner_lines.min); - inner_lines.max = clamp_top(inner_lines.max, lines.max); - inner_lines.min -= 1; - inner_lines.max += 1; - if (lines.min <= inner_lines.min){ - r[0] = Ii64(lines.min, inner_lines.min); - } - if (inner_lines.max <= lines.max){ - r[1] = Ii64(inner_lines.max, lines.max); - } - } - else{ - r[0] = get_line_range_from_pos_range(app, buffer, range); - } - for (i32 j = 0; j < 2; j += 1){ - if (r[j].min == 0){ - continue; - } - Range_i64 line_range = r[j]; - if (back_colors != 0){ - draw_line_highlight(app, text_layout_id, line_range, back_colors[color_index]); - } - if (fore_colors != 0){ - Range_i64 pos_range = get_pos_range_from_line_range(app, buffer, line_range); - paint_text_color(app, text_layout_id, pos_range, fore_colors[color_index]); - } - } - } - else{ - if (back_colors != 0){ - draw_character_block(app, text_layout_id, range.min, 0.f, back_colors[color_index]); - draw_character_block(app, text_layout_id, range.max - 1, 0.f, back_colors[color_index]); - } - if (fore_colors != 0){ - paint_text_color_pos(app, text_layout_id, range.min, fore_colors[color_index]); - paint_text_color_pos(app, text_layout_id, range.max - 1, fore_colors[color_index]); - } - } - color_index += 1; - color_index = (color_index%color_count); - } -} - #if 0 static argb_color default_colors[Stag_COUNT] = {}; MODIFY_COLOR_TABLE_SIG(default_modify_color_table){ @@ -280,66 +193,41 @@ MODIFY_COLOR_TABLE_SIG(default_modify_color_table){ function Rect_f32_Pair layout_file_bar_on_top(Rect_f32 rect, f32 line_height){ - return(rect_split_top_bottom(rect, line_height + 4.f)); + return(rect_split_top_bottom(rect, line_height + 2.f)); } function Rect_f32_Pair layout_file_bar_on_bot(Rect_f32 rect, f32 line_height){ - return(rect_split_top_bottom_neg(rect, line_height + 4.f)); + return(rect_split_top_bottom_neg(rect, line_height + 2.f)); } -internal int_color -get_token_color_cpp(Token token){ - int_color result = Stag_Default; - switch (token.kind){ - case TokenBaseKind_Preprocessor: - { - result = Stag_Preproc; - }break; - case TokenBaseKind_Keyword: - { - result = Stag_Keyword; - }break; - case TokenBaseKind_Comment: - { - result = Stag_Comment; - }break; - case TokenBaseKind_LiteralString: - { - result = Stag_Str_Constant; - }break; - case TokenBaseKind_LiteralInteger: - { - result = Stag_Int_Constant; - }break; - case TokenBaseKind_LiteralFloat: - { - result = Stag_Float_Constant; - }break; - default: - { - switch (token.sub_kind){ - case TokenCppKind_LiteralTrue: - case TokenCppKind_LiteralFalse: - { - result = Stag_Bool_Constant; - }break; - case TokenCppKind_LiteralCharacter: - case TokenCppKind_LiteralCharacterWide: - case TokenCppKind_LiteralCharacterUTF8: - case TokenCppKind_LiteralCharacterUTF16: - case TokenCppKind_LiteralCharacterUTF32: - { - result = Stag_Char_Constant; - }break; - case TokenCppKind_PPIncludeFile: - { - result = Stag_Include; - }break; - } - }break; - } - return(result); +function Rect_f32_Pair +layout_query_bar_on_top(Rect_f32 rect, f32 line_height, i32 bar_count){ + return(rect_split_top_bottom(rect, (line_height + 2.f)*bar_count)); +} + +function Rect_f32_Pair +layout_query_bar_on_bot(Rect_f32 rect, f32 line_height, i32 bar_count){ + return(rect_split_top_bottom_neg(rect, (line_height + 2.f)*bar_count)); +} + +function Rect_f32_Pair +layout_line_number_margin(Rect_f32 rect, f32 digit_advance, i64 digit_count){ + f32 margin_width = (f32)digit_count*digit_advance + 2.f; + return(rect_split_left_right(rect, margin_width)); +} + +function Rect_f32_Pair +layout_line_number_margin(Application_Links *app, Buffer_ID buffer, Rect_f32 rect, f32 digit_advance){ + i64 line_count = buffer_get_line_count(app, buffer); + i64 line_count_digit_count = digit_count_from_integer(line_count, 10); + return(layout_line_number_margin(rect, digit_advance, line_count_digit_count)); +} + +global_const i32 fps_history_depth = 10; +function Rect_f32_Pair +layout_fps_hud_on_bottom(Rect_f32 rect, f32 line_height){ + return(rect_split_top_bottom_neg(rect, line_height*fps_history_depth)); } function Rect_f32 @@ -349,33 +237,38 @@ default_buffer_region(Application_Links *app, View_ID view_id, Rect_f32 region){ Buffer_ID buffer = view_get_buffer(app, view_id, AccessAll); Face_ID face_id = get_face_id(app, buffer); Face_Metrics metrics = get_face_metrics(app, face_id); - f32 line_height = metrics.line_height; + f32 line_height = metrics.line_height; + f32 digit_advance = metrics.decimal_digit_advance; - // file bar + // NOTE(allen): file bar b64 showing_file_bar = false; if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar) && showing_file_bar){ Rect_f32_Pair pair = layout_file_bar_on_top(region, line_height); - region = pair.b; + region = pair.min; } - // query bar + // NOTE(allen): query bars { Query_Bar *space[32]; Query_Bar_Ptr_Array query_bars = {}; query_bars.ptrs = space; if (get_active_query_bars(app, view_id, ArrayCount(space), &query_bars)){ - f32 widget_height = (line_height + 2)*query_bars.count; - region.y0 += widget_height; + Rect_f32_Pair pair = layout_query_bar_on_top(region, line_height, query_bars.count); + region = pair.min; } } - // line number margins + // NOTE(allen): FPS hud + if (show_fps_hud){ + Rect_f32_Pair pair = layout_fps_hud_on_bottom(region, line_height); + region = pair.min; + } + + // NOTE(allen): line numbers if (global_config.show_line_number_margins){ - i64 line_count = buffer_get_line_count(app, buffer); - i64 line_count_digit_count = digit_count_from_integer(line_count, 10); - i32 margin_width = i32_ceil32((f32)line_count_digit_count*metrics.normal_advance); - region.x0 += margin_width + 2; + Rect_f32_Pair pair = layout_line_number_margin(app, buffer, region, digit_advance); + region = pair.max; } return(region); @@ -431,7 +324,510 @@ draw_file_bar(Application_Links *app, View_ID view_id, Buffer_ID buffer, Face_ID draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0); } -internal void +function void +draw_query_bar(Application_Links *app, Query_Bar *query_bar, Face_ID face_id, Rect_f32 bar){ + Scratch_Block scratch(app); + Fancy_String_List list = {}; + push_fancy_string(scratch, &list, fancy_id(Stag_Pop1) , query_bar->prompt); + push_fancy_string(scratch, &list, fancy_id(Stag_Default), query_bar->string); + Vec2_f32 p = bar.p0 + V2(2.f, 2.f); + draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0); +} + +function void +draw_line_number_margin(Application_Links *app, View_ID view_id, Buffer_ID buffer, Face_ID face_id, + Text_Layout_ID text_layout_id, Rect_f32 margin){ + Rect_f32 prev_clip = draw_set_clip(app, margin); + draw_rectangle(app, margin, 0.f, Stag_Line_Numbers_Back); + + Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + + Fancy_Color line_color = fancy_id(Stag_Line_Numbers_Text); + + i64 line_count = buffer_get_line_count(app, buffer); + i64 line_count_digit_count = digit_count_from_integer(line_count, 10); + + Scratch_Block scratch(app, Scratch_Share); + + Buffer_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(visible_range.first)); + i64 line_number = cursor.line; + for (;cursor.pos <= visible_range.one_past_last;){ + if (line_number > line_count){ + break; + } + Range_f32 line_y = text_layout_line_on_screen(app, text_layout_id, line_number); + Vec2_f32 p = V2f32(margin.x0, line_y.min); + Temp_Memory_Block temp(scratch); + Fancy_String *line_string = push_fancy_stringf(scratch, line_color, "%*lld", line_count_digit_count, line_number); + draw_fancy_string(app, face_id, line_string, p, Stag_Margin_Active, 0); + line_number += 1; + } + + draw_set_clip(app, prev_clip); +} + +function void +draw_fps_hud(Application_Links *app, Frame_Info frame_info, + Face_ID face_id, Rect_f32 rect){ + Face_Metrics face_metrics = get_face_metrics(app, face_id); + f32 line_height = face_metrics.line_height; + + local_persist f32 history_literal_dt[fps_history_depth] = {}; + local_persist f32 history_animation_dt[fps_history_depth] = {}; + local_persist i32 history_frame_index[fps_history_depth] = {}; + + i32 wrapped_index = frame_info.index%fps_history_depth; + history_literal_dt[wrapped_index] = frame_info.literal_dt; + history_animation_dt[wrapped_index] = frame_info.animation_dt; + history_frame_index[wrapped_index] = frame_info.index; + + draw_rectangle(app, rect, 0.f, 0xFF000000); + draw_rectangle_outline(app, rect, 0.f, 1.f, 0xFFFFFFFF); + + Vec2_f32 p = rect.p0; + + Scratch_Block scratch(app); + + Range ranges[2]; + ranges[0].first = wrapped_index; + ranges[0].one_past_last = -1; + ranges[1].first = fps_history_depth - 1; + ranges[1].one_past_last = wrapped_index; + for (i32 i = 0; i < 2; i += 1){ + Range r = ranges[i]; + for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += line_height){ + f32 dts[2]; + dts[0] = history_literal_dt[j]; + dts[1] = history_animation_dt[j]; + i32 frame_index = history_frame_index[j]; + + Fancy_String_List list = {}; + push_fancy_stringf(scratch, &list, pink , "FPS: "); + push_fancy_stringf(scratch, &list, green, "["); + push_fancy_stringf(scratch, &list, white, "%5d", frame_index); + push_fancy_stringf(scratch, &list, green, "]: "); + + for (i32 k = 0; k < 2; k += 1){ + f32 dt = dts[k]; + if (dt == 0.f){ + push_fancy_stringf(scratch, &list, white, "----------"); + } + else{ + push_fancy_stringf(scratch, &list, white, "%10.6f", dt); + } + push_fancy_stringf(scratch, &list, green, " | "); + } + + draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f)); + } + } +} + +function int_color +get_token_color_cpp(Token token){ + int_color result = Stag_Default; + switch (token.kind){ + case TokenBaseKind_Preprocessor: + { + result = Stag_Preproc; + }break; + case TokenBaseKind_Keyword: + { + result = Stag_Keyword; + }break; + case TokenBaseKind_Comment: + { + result = Stag_Comment; + }break; + case TokenBaseKind_LiteralString: + { + result = Stag_Str_Constant; + }break; + case TokenBaseKind_LiteralInteger: + { + result = Stag_Int_Constant; + }break; + case TokenBaseKind_LiteralFloat: + { + result = Stag_Float_Constant; + }break; + default: + { + switch (token.sub_kind){ + case TokenCppKind_LiteralTrue: + case TokenCppKind_LiteralFalse: + { + result = Stag_Bool_Constant; + }break; + case TokenCppKind_LiteralCharacter: + case TokenCppKind_LiteralCharacterWide: + case TokenCppKind_LiteralCharacterUTF8: + case TokenCppKind_LiteralCharacterUTF16: + case TokenCppKind_LiteralCharacterUTF32: + { + result = Stag_Char_Constant; + }break; + case TokenCppKind_PPIncludeFile: + { + result = Stag_Include; + }break; + } + }break; + } + return(result); +} + +function void +draw_buffer_add_cpp_token_colors(Application_Links *app, Text_Layout_ID text_layout_id, Token_Array *array){ + Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + i64 first_index = token_index_from_pos(array, visible_range.first); + Token_Iterator_Array it = token_iterator_index(0, array, first_index); + for (;;){ + Token *token = token_it_read(&it); + if (token->pos >= visible_range.one_past_last){ + break; + } + int_color color = get_token_color_cpp(*token); + paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color); + if (!token_it_inc_non_whitespace(&it)){ + break; + } + } +} + +struct Comment_Highlight_Pair{ + String_Const_u8 needle; + int_color color; +}; + +function void +draw_comment_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, + Token_Array *array, Comment_Highlight_Pair *pairs, i32 pair_count){ + Scratch_Block scratch(app); + Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + i64 first_index = token_index_from_pos(array, visible_range.first); + Token_Iterator_Array it = token_iterator_index(buffer, array, first_index); + for (;;){ + Temp_Memory_Block temp(scratch); + Token *token = token_it_read(&it); + if (token->pos >= visible_range.one_past_last){ + break; + } + String_Const_u8 tail = {}; + if (token_it_check_and_get_lexeme(app, scratch, &it, TokenBaseKind_Comment, &tail)){ + for (i64 index = token->pos; + tail.size > 0; + tail = string_skip(tail, 1), index += 1){ + Comment_Highlight_Pair *pair = pairs; + for (i32 i = 0; i < pair_count; i += 1, pair += 1){ + umem needle_size = pair->needle.size; + if (needle_size == 0){ + continue; + } + String_Const_u8 prefix = string_prefix(tail, needle_size); + if (string_match(prefix, pair->needle)){ + Range_i64 range = Ii64_size(index, needle_size); + paint_text_color(app, text_layout_id, range, pair->color); + tail = string_skip(tail, needle_size - 1); + index += needle_size - 1; + break; + } + } + } + } + if (!token_it_inc_non_whitespace(&it)){ + break; + } + } +} + +internal Range_i64_Array +get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 pos, u32 flags){ + Range_i64_Array array = {}; + i32 max = 100; + array.ranges = push_array(arena, Range_i64, max); + for (;;){ + Range_i64 range = {}; + if (find_surrounding_nest(app, buffer, pos, flags, &range)){ + array.ranges[array.count] = range; + array.count += 1; + pos = range.first; + if (array.count >= max){ + break; + } + } + else{ + break; + } + } + return(array); +} + +typedef i32 Range_Highlight_Kind; +enum{ + RangeHighlightKind_LineHighlight, + RangeHighlightKind_CharacterHighlight, +}; + +function void +draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID buffer, + i64 pos, u32 flags, Range_Highlight_Kind kind, + int_color *back_colors, int_color *fore_colors, i32 color_count){ + Scratch_Block scratch(app); + Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags); + + i32 color_index = 0; + for (i32 i = ranges.count - 1; i >= 0; i -= 1){ + Range_i64 range = ranges.ranges[i]; + if (kind == RangeHighlightKind_LineHighlight){ + Range_i64 r[2] = {}; + if (i > 0){ + Range_i64 inner_range = ranges.ranges[i - 1]; + Range_i64 lines = get_line_range_from_pos_range(app, buffer, range); + Range_i64 inner_lines = get_line_range_from_pos_range(app, buffer, inner_range); + inner_lines.min = clamp_bot(lines.min, inner_lines.min); + inner_lines.max = clamp_top(inner_lines.max, lines.max); + inner_lines.min -= 1; + inner_lines.max += 1; + if (lines.min <= inner_lines.min){ + r[0] = Ii64(lines.min, inner_lines.min); + } + if (inner_lines.max <= lines.max){ + r[1] = Ii64(inner_lines.max, lines.max); + } + } + else{ + r[0] = get_line_range_from_pos_range(app, buffer, range); + } + for (i32 j = 0; j < 2; j += 1){ + if (r[j].min == 0){ + continue; + } + Range_i64 line_range = r[j]; + if (back_colors != 0){ + draw_line_highlight(app, text_layout_id, line_range, back_colors[color_index]); + } + if (fore_colors != 0){ + Range_i64 pos_range = get_pos_range_from_line_range(app, buffer, line_range); + paint_text_color(app, text_layout_id, pos_range, fore_colors[color_index]); + } + } + } + else{ + if (back_colors != 0){ + draw_character_block(app, text_layout_id, range.min, 0.f, back_colors[color_index]); + draw_character_block(app, text_layout_id, range.max - 1, 0.f, back_colors[color_index]); + } + if (fore_colors != 0){ + paint_text_color_pos(app, text_layout_id, range.min, fore_colors[color_index]); + paint_text_color_pos(app, text_layout_id, range.max - 1, fore_colors[color_index]); + } + } + color_index += 1; + color_index = (color_index%color_count); + } +} + +function void +draw_scope_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, + i64 pos, int_color *colors, i32 color_count){ + draw_enclosures(app, text_layout_id, buffer, + pos, FindNest_Scope, RangeHighlightKind_LineHighlight, + colors, 0, color_count); +} + +function void +draw_paren_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, + i64 pos, int_color *colors, i32 color_count){ + Token_Array token_array = get_token_array_from_buffer(app, buffer); + if (token_array.tokens != 0){ + Token_Iterator_Array it = token_iterator_pos(0, &token_array, pos); + Token *token = token_it_read(&it); + if (token != 0 && token->kind == TokenBaseKind_ParentheticalOpen){ + pos = token->pos + token->size; + } + else{ + if (token_it_dec_all(&it)){ + token = token_it_read(&it); + if (token->kind == TokenBaseKind_ParentheticalClose && + pos == token->pos + token->size){ + pos = token->pos; + } + } + } + } + draw_enclosures(app, text_layout_id, buffer, + pos, FindNest_Paren, RangeHighlightKind_CharacterHighlight, + 0, colors, color_count); +} + +function void +draw_jump_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, + Buffer_ID jump_buffer, int_color line_color){ + Scratch_Block scratch(app); + if (jump_buffer != 0){ + Managed_Scope scopes[2]; + scopes[0] = buffer_get_managed_scope(app, jump_buffer); + scopes[1] = buffer_get_managed_scope(app, buffer); + Managed_Scope comp_scope = get_managed_scope_with_multiple_dependencies(app, scopes, ArrayCount(scopes)); + Managed_Object *markers_object = scope_attachment(app, comp_scope, sticky_jump_marker_handle, Managed_Object); + + i32 count = managed_object_get_item_count(app, *markers_object); + Marker *markers = push_array(scratch, Marker, count); + managed_object_load_data(app, *markers_object, 0, count, markers); + for (i32 i = 0; i < count; i += 1){ + i64 line_number = get_line_number_from_pos(app, buffer, markers[i].pos); + draw_line_highlight(app, text_layout_id, line_number, line_color); + } + } +} + +function b32 +draw_highlight_range(Application_Links *app, View_ID view_id, + Buffer_ID buffer, Text_Layout_ID text_layout_id, + f32 roundness){ + b32 has_highlight_range = false; + Managed_Scope scope = view_get_managed_scope(app, view_id); + Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID); + if (*highlight_buffer != 0){ + if (*highlight_buffer != buffer){ + view_disable_highlight_range(app, view_id); + } + else{ + has_highlight_range = true; + Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); + Marker marker_range[2]; + if (managed_object_load_data(app, *highlight, 0, 2, marker_range)){ + Range_i64 range = Ii64(marker_range[0].pos, marker_range[1].pos); + draw_character_block(app, text_layout_id, range, roundness, Stag_Highlight); + paint_text_color(app, text_layout_id, range, Stag_At_Highlight); + } + } + } + return(has_highlight_range); +} + +function void +draw_original_4coder_style_cursor_mark_highlight(Application_Links *app, View_ID view_id, b32 is_active_view, + Buffer_ID buffer, Text_Layout_ID text_layout_id, + f32 roundness, f32 outline_thickness){ + b32 has_highlight_range = draw_highlight_range(app, view_id, buffer, text_layout_id, roundness); + if (!has_highlight_range){ + i64 cursor_pos = view_get_cursor_pos(app, view_id); + i64 mark_pos = view_get_mark_pos(app, view_id); + if (is_active_view){ + draw_character_block(app, text_layout_id, cursor_pos, roundness, Stag_Cursor); + paint_text_color_pos(app, text_layout_id, cursor_pos, Stag_At_Cursor); + draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, Stag_Mark); + } + else{ + draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, Stag_Mark); + draw_character_wire_frame(app, text_layout_id, cursor_pos, roundness, outline_thickness, Stag_Cursor); + } + } +} + +function void +draw_notepad_style_cursor_highlight(Application_Links *app, View_ID view_id, + Buffer_ID buffer, Text_Layout_ID text_layout_id, + f32 roundness){ + b32 has_highlight_range = draw_highlight_range(app, view_id, buffer, text_layout_id, roundness); + if (!has_highlight_range){ + i64 cursor_pos = view_get_cursor_pos(app, view_id); + i64 mark_pos = view_get_mark_pos(app, view_id); + if (cursor_pos != mark_pos){ + Range_i64 range = Ii64(cursor_pos, mark_pos); + draw_character_block(app, text_layout_id, range, roundness, Stag_Highlight); + paint_text_color(app, text_layout_id, range, Stag_At_Highlight); + } + draw_character_i_bar(app, text_layout_id, cursor_pos, Stag_Cursor); + } +} + +function void +default_render_buffer(Application_Links *app, View_ID view_id, b32 is_active_view, + Buffer_ID buffer, Text_Layout_ID text_layout_id, + Rect_f32 rect){ + Rect_f32 prev_clip = draw_set_clip(app, rect); + + // NOTE(allen): Token colorizing + Token_Array token_array = get_token_array_from_buffer(app, buffer); + if (token_array.tokens != 0){ + draw_buffer_add_cpp_token_colors(app, text_layout_id, &token_array); + + // NOTE(allen): Scan for TODOs and NOTEs + if (global_config.use_comment_keyword){ + Comment_Highlight_Pair pairs[] = { + {string_u8_litexpr("NOTE"), Stag_Text_Cycle_2}, + {string_u8_litexpr("TODO"), Stag_Text_Cycle_1}, + }; + draw_comment_highlights(app, buffer, text_layout_id, + &token_array, pairs, ArrayCount(pairs)); + } + } + + i64 cursor_pos = view_get_cursor_pos(app, view_id); + + // NOTE(allen): Scope highlight + if (global_config.use_scope_highlight){ + int_color colors[] = { Stag_Back_Cycle_1, Stag_Back_Cycle_2, Stag_Back_Cycle_3, Stag_Back_Cycle_4, }; + draw_scope_highlight(app, buffer, text_layout_id, cursor_pos, colors, ArrayCount(colors)); + } + + if (global_config.use_error_highlight || global_config.use_jump_highlight){ + // NOTE(allen): Error highlight + String_Const_u8 name = string_u8_litexpr("*compilation*"); + Buffer_ID compilation_buffer = get_buffer_by_name(app, name, AccessAll); + if (global_config.use_error_highlight){ + draw_jump_highlights(app, buffer, text_layout_id, compilation_buffer, Stag_Highlight_Junk); + } + + // NOTE(allen): Search highlight + if (global_config.use_jump_highlight){ + Buffer_ID jump_buffer = get_locked_jump_buffer(app); + if (jump_buffer != compilation_buffer){ + draw_jump_highlights(app, buffer, text_layout_id, jump_buffer, Stag_Highlight_White); + } + } + } + + // NOTE(allen): Color parens + if (global_config.use_paren_helper){ + int_color colors[] = { Stag_Text_Cycle_1, Stag_Text_Cycle_2, Stag_Text_Cycle_3, Stag_Text_Cycle_4, }; + draw_paren_highlight(app, buffer, text_layout_id, cursor_pos, colors, ArrayCount(colors)); + } + + // NOTE(allen): Line highlight + if (global_config.highlight_line_at_cursor && is_active_view){ + i64 line_number = get_line_number_from_pos(app, buffer, cursor_pos); + draw_line_highlight(app, text_layout_id, line_number, Stag_Highlight_Cursor_Line); + } + + // NOTE(allen): Cursor shape + f32 cursor_roundness = 4.f; + f32 mark_thickness = 2.f; + + // NOTE(allen): Cursor + switch (fcoder_mode){ + case FCoderMode_Original: + { + draw_original_4coder_style_cursor_mark_highlight(app, view_id, is_active_view, + buffer, text_layout_id, + cursor_roundness, mark_thickness); + }break; + case FCoderMode_NotepadLike: + { + draw_notepad_style_cursor_highlight(app, view_id, buffer, text_layout_id, cursor_roundness); + }break; + } + + // NOTE(allen): put the actual text on the actual screen + draw_text_layout(app, text_layout_id); + + draw_set_clip(app, prev_clip); +} + +function void default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID view_id){ View_ID active_view = get_active_view(app, AccessAll); b32 is_active_view = (active_view == view_id); @@ -448,19 +844,19 @@ default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID vie Face_ID face_id = get_face_id(app, buffer); Face_Metrics face_metrics = get_face_metrics(app, face_id); f32 line_height = face_metrics.line_height; + f32 digit_advance = face_metrics.decimal_digit_advance; // NOTE(allen): Frame - Rect_f32 r_cursor = inner; + Rect_f32 region = inner; - // NOTE(allen): Filebar + // NOTE(allen): file bar b64 showing_file_bar = false; if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar) && showing_file_bar){ - Rect_f32_Pair pair = layout_file_bar_on_top(r_cursor, line_height); + Rect_f32_Pair pair = layout_file_bar_on_top(region, line_height); draw_file_bar(app, view_id, buffer, face_id, pair.min); - r_cursor = pair.max; + region = pair.max; } - Rect_f32 buffer_rect = default_buffer_region(app, view_id, view_rect); Buffer_Scroll scroll = view_get_buffer_scroll(app, view_id); Buffer_Point_Delta_Result delta = delta_apply(app, view_id, @@ -473,313 +869,51 @@ default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID vie animate_in_n_milliseconds(app, 0); } - Buffer_Point buffer_point = scroll.position; - Text_Layout_ID text_layout_id = text_layout_create(app, buffer, buffer_rect, buffer_point); - Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); - - Scratch_Block scratch(app); - - { - Rect_f32 prev_clip_sub = draw_set_clip(app, buffer_rect); - - // NOTE(allen): Token colorizing - Token_Array token_array = get_token_array_from_buffer(app, buffer); - if (token_array.tokens != 0){ - i64 first_index = token_index_from_pos(&token_array, visible_range.first); - Token_Iterator_Array it = token_iterator_index(buffer, &token_array, first_index); - for (;;){ - Token *token = token_it_read(&it); - if (token->pos >= visible_range.one_past_last){ - break; - } - - int_color color = get_token_color_cpp(*token); - paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color); - - if (!token_it_inc_non_whitespace(&it)){ - break; - } - } - } - - // NOTE(allen): Scan for TODOs and NOTEs - if (global_config.use_comment_keyword){ - Temp_Memory temp = begin_temp(scratch); - String_Const_u8 tail = push_buffer_range(app, scratch, buffer, visible_range); - i32 index = 0; - for (;tail.size > 0; tail = string_skip(tail, 1), index += 1){ - if (string_match(string_prefix(tail, 4), string_u8_litexpr("NOTE"))){ - Interval_i64 range = Ii64_size(visible_range.first + index, 4); - paint_text_color(app, text_layout_id, range, Stag_Text_Cycle_2); - tail = string_skip(tail, 3); - index += 3; - } - else if (string_match(string_prefix(tail, 4), string_u8_litexpr("TODO"))){ - Interval_i64 range = Ii64_size(visible_range.first + index, 4); - paint_text_color(app, text_layout_id, range, Stag_Text_Cycle_1); - tail = string_skip(tail, 3); - index += 3; - } - } - end_temp(temp); - } - - i64 cursor_pos = view_get_cursor_pos(app, view_id); - i64 mark_pos = view_get_mark_pos(app, view_id); - - // NOTE(allen): Scope highlight - if (do_matching_enclosure_highlight){ - static const i32 color_count = 4; - int_color colors[color_count]; - for (u16 i = 0; i < color_count; i += 1){ - colors[i] = Stag_Back_Cycle_1 + i; - } - draw_enclosures(app, text_layout_id, buffer, - cursor_pos, FindNest_Scope, RangeHighlightKind_LineHighlight, - colors, 0, color_count); - } - - // NOTE(allen): Error highlight - { - String_Const_u8 name = string_u8_litexpr("*compilation*"); - Buffer_ID compilation_buffer = get_buffer_by_name(app, name, AccessAll); - if (compilation_buffer != 0){ - Managed_Scope scopes[2]; - scopes[0] = buffer_get_managed_scope(app, compilation_buffer); - scopes[1] = buffer_get_managed_scope(app, buffer); - Managed_Scope comp_scope = get_managed_scope_with_multiple_dependencies(app, scopes, ArrayCount(scopes)); - Managed_Object *markers_object = scope_attachment(app, comp_scope, sticky_jump_marker_handle, Managed_Object); - - Temp_Memory temp = begin_temp(scratch); - i32 count = managed_object_get_item_count(app, *markers_object); - Marker *markers = push_array(scratch, Marker, count); - managed_object_load_data(app, *markers_object, 0, count, markers); - for (i32 i = 0; i < count; i += 1){ - i64 line_number = get_line_number_from_pos(app, buffer, markers[i].pos); - draw_line_highlight(app, text_layout_id, line_number, - Stag_Highlight_Junk); - } - end_temp(temp); - } - } - - // NOTE(allen): Color parens - if (do_matching_paren_highlight){ - i64 pos = cursor_pos; - if (buffer_get_char(app, buffer, pos) == '('){ - pos += 1; - } - else if (pos > 0){ - if (buffer_get_char(app, buffer, pos - 1) == ')'){ - pos -= 1; - } - } - static const i32 color_count = 4; - int_color colors[color_count]; - for (u16 i = 0; i < color_count; i += 1){ - colors[i] = Stag_Text_Cycle_1 + i; - } - draw_enclosures(app, text_layout_id, buffer, - cursor_pos, FindNest_Paren, RangeHighlightKind_CharacterHighlight, - 0, colors, color_count); - } - - // NOTE(allen): Line highlight - if (highlight_line_at_cursor && is_active_view){ - i64 line_number = get_line_number_from_pos(app, buffer, cursor_pos); - draw_line_highlight(app, text_layout_id, line_number, Stag_Highlight_Cursor_Line); - } - - // NOTE(allen): Roundness - f32 cursor_roundness = 4.f; - f32 mark_thickness = 2.f; - - // NOTE(allen): Highlight range - b32 has_highlight_range = false; - { - Managed_Scope scope = view_get_managed_scope(app, view_id); - Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID); - if (*highlight_buffer != 0){ - if (*highlight_buffer != buffer){ - view_disable_highlight_range(app, view_id); - } - else{ - has_highlight_range = true; - Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); - Marker marker_range[2]; - if (managed_object_load_data(app, *highlight, 0, 2, marker_range)){ - Range_i64 range = Ii64(marker_range[0].pos, marker_range[1].pos); - draw_character_block(app, text_layout_id, range, cursor_roundness, Stag_Highlight); - paint_text_color(app, text_layout_id, range, Stag_At_Highlight); - } - } - } - } - - // NOTE(allen): Cursor and mark - if (!has_highlight_range){ - switch (fcoder_mode){ - case FCoderMode_Original: - { - if (is_active_view){ - draw_character_block(app, text_layout_id, cursor_pos, - cursor_roundness, Stag_Cursor); - paint_text_color_pos(app, text_layout_id, cursor_pos, - Stag_At_Cursor); - draw_character_wire_frame(app, text_layout_id, mark_pos, - cursor_roundness, mark_thickness, - Stag_Mark); - } - else{ - draw_character_wire_frame(app, text_layout_id, mark_pos, - cursor_roundness, mark_thickness, - Stag_Mark); - draw_character_wire_frame(app, text_layout_id, cursor_pos, - cursor_roundness, mark_thickness, - Stag_Cursor); - } - }break; - - case FCoderMode_NotepadLike: - { - if (cursor_pos != mark_pos){ - Range_i64 range = Ii64(cursor_pos, mark_pos); - draw_character_block(app, text_layout_id, range, - cursor_roundness, Stag_Highlight); - paint_text_color(app, text_layout_id, range, Stag_At_Highlight); - } - draw_character_i_bar(app, text_layout_id, cursor_pos, Stag_Cursor); - }break; - } - } - - draw_text_layout(app, text_layout_id); - draw_set_clip(app, prev_clip_sub); - } - - // NOTE(allen): FPS HUD - if (show_fps_hud){ - static const i32 history_depth = 10; - static f32 history_literal_dt[history_depth] = {}; - static f32 history_animation_dt[history_depth] = {}; - static i32 history_frame_index[history_depth] = {}; - - i32 wrapped_index = frame_info.index%history_depth; - history_literal_dt[wrapped_index] = frame_info.literal_dt; - history_animation_dt[wrapped_index] = frame_info.animation_dt; - history_frame_index[wrapped_index] = frame_info.index; - - Rect_f32 hud_rect = view_get_screen_rect(app, view_id); - hud_rect.y0 = hud_rect.y1 - line_height*(f32)(history_depth); - draw_rectangle(app, hud_rect, 0.f, 0xFF000000); - draw_rectangle_outline(app, hud_rect, 0.f, 1.f, 0xFFFFFFFF); - - Vec2 p = hud_rect.p0; - - Range ranges[2]; - ranges[0].first = wrapped_index; - ranges[0].one_past_last = -1; - ranges[1].first = history_depth - 1; - ranges[1].one_past_last = wrapped_index; - for (i32 i = 0; i < 2; i += 1){ - Range r = ranges[i]; - for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += line_height){ - f32 dts[2]; - dts[0] = history_literal_dt[j]; - dts[1] = history_animation_dt[j]; - i32 frame_index = history_frame_index[j]; - - Fancy_String_List list = {}; - push_fancy_stringf(scratch, &list, pink , "FPS: "); - push_fancy_stringf(scratch, &list, green, "["); - push_fancy_stringf(scratch, &list, white, "%5d", frame_index); - push_fancy_stringf(scratch, &list, green, "]: "); - - for (i32 k = 0; k < 2; k += 1){ - f32 dt = dts[k]; - if (dt == 0.f){ - push_fancy_stringf(scratch, &list, white, "----------"); - } - else{ - push_fancy_stringf(scratch, &list, white, "%10.6f", dt); - } - push_fancy_stringf(scratch, &list, green, " | "); - } - - draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f)); - } - } - - animate_in_n_milliseconds(app, 1000); - } - - // NOTE(allen): Query Bars + // NOTE(allen): query bars { Query_Bar *space[32]; Query_Bar_Ptr_Array query_bars = {}; query_bars.ptrs = space; if (get_active_query_bars(app, view_id, ArrayCount(space), &query_bars)){ for (i32 i = 0; i < query_bars.count; i += 1){ - Query_Bar *query_bar = query_bars.ptrs[i]; - - Rect_f32 bar = r_cursor; - bar.y1 = bar.y0 + line_height + 2.f; - r_cursor.y0 = bar.y1; - - Temp_Memory temp = begin_temp(scratch); - Fancy_String_List list = {}; - - Fancy_Color default_color = fancy_id(Stag_Default); - Fancy_Color pop1_color = fancy_id(Stag_Pop1); - - push_fancy_string(scratch, &list, pop1_color , query_bar->prompt); - push_fancy_string(scratch, &list, default_color, query_bar->string); - - Vec2 p = bar.p0 + V2(0.f, 2.f); - draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0); - - end_temp(temp); + Rect_f32_Pair pair = layout_query_bar_on_top(region, line_height, 1); + draw_query_bar(app, query_bars.ptrs[i], face_id, pair.min); + region = pair.max; } } } - // NOTE(allen): Line Numbers - if (global_config.show_line_number_margins){ - i64 line_count = buffer_get_line_count(app, buffer); - i64 line_count_digit_count = digit_count_from_integer(line_count, 10); - // TODO(allen): I need a "digit width" - f32 zero = get_string_advance(app, face_id, string_u8_litexpr("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.f; - r_cursor.x0 = left_margin.x1; - - draw_rectangle(app, left_margin, 0.f, Stag_Line_Numbers_Back); - - Rect_f32 prev_clip_line_numbers = draw_set_clip(app, left_margin); - - Fancy_Color line_color = fancy_id(Stag_Line_Numbers_Text); - - Buffer_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(visible_range.first)); - i64 line_number = cursor.line; - for (;cursor.pos <= visible_range.one_past_last;){ - if (line_number > line_count){ - break; - } - Range_f32 line_y = text_layout_line_on_screen(app, text_layout_id, line_number); - Vec2_f32 p = V2f32(left_margin.x0, line_y.min); - Temp_Memory_Block temp(scratch); - Fancy_String *line_string = push_fancy_stringf(scratch, line_color, "%*lld", line_count_digit_count, line_number); - draw_fancy_string(app, face_id, line_string, p, Stag_Margin_Active, 0); - line_number += 1; - } - - draw_set_clip(app, prev_clip_line_numbers); + // NOTE(allen): FPS hud + if (show_fps_hud){ + Rect_f32_Pair pair = layout_fps_hud_on_bottom(region, line_height); + draw_fps_hud(app, frame_info, face_id, pair.max); + region = pair.min; + animate_in_n_milliseconds(app, 1000); } + // NOTE(allen): layout line numbers + Rect_f32 line_number_rect = {}; + if (global_config.show_line_number_margins){ + Rect_f32_Pair pair = layout_line_number_margin(app, buffer, region, digit_advance); + line_number_rect = pair.min; + region = pair.max; + } + + // NOTE(allen): begin buffer render + Buffer_Point buffer_point = scroll.position; + Text_Layout_ID text_layout_id = text_layout_create(app, buffer, region, buffer_point); + + // NOTE(allen): draw line numbers + if (global_config.show_line_number_margins){ + draw_line_number_margin(app, view_id, buffer, face_id, text_layout_id, line_number_rect); + } + + // NOTE(allen): draw the buffer + default_render_buffer(app, view_id, is_active_view, + buffer, text_layout_id, + region); + text_layout_free(app, text_layout_id); - draw_set_clip(app, prev_clip); } @@ -900,7 +1034,7 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ } } -internal void +function void do_full_lex(Application_Links *app, Buffer_ID buffer_id){ Scratch_Block scratch(app); String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); @@ -1144,14 +1278,6 @@ BUFFER_HOOK_SIG(default_end_file){ internal void set_all_default_hooks(Application_Links *app){ -#if 0 - set_custom_hook(app, HookID_Exit, default_exit); - set_custom_hook(app, HookID_Start, default_start); - set_custom_hook(app, HookID_FileExternallyModified, default_file_externally_modified); - set_custom_hook(app, HookID_InputFilter, default_suppress_mouse_filter); - set_custom_hook(app, HookID_ModifyColorTable, default_modify_color_table); -#endif - set_custom_hook(app, HookID_BufferViewerUpdate, default_view_adjust); set_custom_hook(app, HookID_ViewEventHandler, default_view_input_handler); diff --git a/custom/4coder_function_list.cpp b/custom/4coder_function_list.cpp index 548db724..0b3b6e67 100644 --- a/custom/4coder_function_list.cpp +++ b/custom/4coder_function_list.cpp @@ -183,7 +183,7 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_I } Temp_Memory token_temp = begin_temp(scratch); - String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, *token); + String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, token); insert_string(out, lexeme); end_temp(token_temp); diff --git a/custom/4coder_helper.cpp b/custom/4coder_helper.cpp index 96163ce4..eaad6f3a 100644 --- a/custom/4coder_helper.cpp +++ b/custom/4coder_helper.cpp @@ -896,8 +896,8 @@ push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_ } internal String_Const_u8 -push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Token token){ - return(push_buffer_range(app, arena, buffer, Ii64(token.pos, token.pos + token.size))); +push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Token *token){ + return(push_buffer_range(app, arena, buffer, Ii64(token))); } internal String_Const_u8 @@ -930,6 +930,50 @@ push_enclose_range_at_pos(Application_Links *app, Arena *arena, Buffer_ID buffer //////////////////////////////// +internal String_Const_u8 +token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_Array *it){ + String_Const_u8 result = {}; + Token *token = token_it_read(it); + if (token != 0){ + result = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + } + return(result); +} + +internal b32 +token_it_check_and_get_lexeme(Application_Links *app, Arena *arena, Token_Iterator_Array *it, Token_Base_Kind kind, String_Const_u8 *lexeme_out){ + Token *token = token_it_read(it); + b32 result = {}; + if (token != 0 && token->kind == kind){ + result = true; + *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + } + return(result); +} + +internal String_Const_u8 +token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it){ + String_Const_u8 result = {}; + Token *token = token_it_read(it); + if (token != 0){ + result = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + } + return(result); +} + +internal b32 +token_it_check_and_get_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it, Token_Base_Kind kind, String_Const_u8 *lexeme_out){ + Token *token = token_it_read(it); + b32 result = {}; + if (token != 0 && token->kind == kind){ + result = true; + *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + } + return(result); +} + +//////////////////////////////// + internal b32 buffer_has_name_with_star(Application_Links *app, Buffer_ID buffer){ Scratch_Block scratch(app); @@ -947,12 +991,6 @@ buffer_get_char(Application_Links *app, Buffer_ID buffer_id, i64 pos){ return(result); } -internal b32 -token_lexeme_string_match(Application_Links *app, Buffer_ID buffer, Token token, String_Const_u8 b){ - Scratch_Block scratch(app); - return(string_match(push_token_lexeme(app, scratch, buffer, token), b)); -} - internal b32 line_is_valid_and_blank(Application_Links *app, Buffer_ID buffer, i64 line_number){ b32 result = false; diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index 73b3a39d..957ed770 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -227,25 +227,25 @@ i32 line_number; }; static Command_Metadata fcoder_metacmd_table[205] = { { PROC_LINKS(default_view_input_handler, 0), "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, -{ 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, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 1996 }, -{ 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, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2002 }, -{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2008 }, -{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2014 }, -{ 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\\custom\\4coder_helper.cpp", 36, 2020 }, -{ 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\\custom\\4coder_helper.cpp", 36, 2028 }, -{ 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, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 196 }, -{ 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, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 206 }, -{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 216 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 226 }, -{ 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\\custom\\4coder_default_framework.cpp", 47, 291 }, -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 297 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 303 }, -{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 309 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 315 }, -{ 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\\custom\\4coder_default_framework.cpp", 47, 321 }, -{ 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\\custom\\4coder_default_framework.cpp", 47, 327 }, -{ 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\\custom\\4coder_default_framework.cpp", 47, 333 }, -{ 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\\custom\\4coder_default_framework.cpp", 47, 339 }, +{ 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, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2034 }, +{ 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, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2040 }, +{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2046 }, +{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2052 }, +{ 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\\custom\\4coder_helper.cpp", 36, 2058 }, +{ 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\\custom\\4coder_helper.cpp", 36, 2066 }, +{ 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, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 203 }, +{ 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, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 213 }, +{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 223 }, +{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 233 }, +{ 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\\custom\\4coder_default_framework.cpp", 47, 298 }, +{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 304 }, +{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 310 }, +{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 316 }, +{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 322 }, +{ 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\\custom\\4coder_default_framework.cpp", 47, 328 }, +{ 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\\custom\\4coder_default_framework.cpp", 47, 334 }, +{ 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\\custom\\4coder_default_framework.cpp", 47, 340 }, +{ 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\\custom\\4coder_default_framework.cpp", 47, 346 }, { PROC_LINKS(write_text_input, 0), "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 58 }, { PROC_LINKS(write_space, 0), "write_space", 11, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 66 }, { PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 72 },