Cleaning up rendering/layout code a lot

master
Allen Webster 2019-10-15 15:30:06 -07:00
parent 2fe332f943
commit 2100e4a9fd
12 changed files with 840 additions and 661 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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)));
}
////////////////////////////////

View File

@ -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];

View File

@ -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;

View File

@ -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)

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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;

View File

@ -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 },