Compare commits

..

No commits in common. "7359649465158670feb917bafc0de54caa5eb2e4" and "6ae690691c46f1e485100e1b606f83efbf820cd6" have entirely different histories.

2 changed files with 45 additions and 42 deletions

View File

@ -96,7 +96,7 @@ struct Code_Index{
Code_Index_File_Storage *storage_last;
i32 storage_count;
Code_Index_Note_List name_hash[10000];
Code_Index_Note_List name_hash[4099];
};
////////////////////////////////

View File

@ -325,13 +325,6 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
f32 mark_thickness = (f32)def_get_config_u64(app, vars_save_string_lit("mark_thickness"));
// NOTE(allen): Token colorizing
ARGB_Color color_default = fcolor_resolve(fcolor_id(defcolor_text_default));
ARGB_Color color_function = fcolor_resolve(fcolor_id(defcolor_function));
ARGB_Color color_operator = fcolor_resolve(fcolor_id(defcolor_operator));
ARGB_Color color_type = fcolor_resolve(fcolor_id(defcolor_type));
ARGB_Color color_macro = fcolor_resolve(fcolor_id(defcolor_macro));
Token_Array token_array = get_token_array_from_buffer(app, buffer);
if (token_array.tokens != 0){
draw_cpp_token_colors(app, text_layout_id, &token_array);
@ -349,45 +342,55 @@ ARGB_Color color_default = fcolor_resolve(fcolor_id(defcolor_text_default));
// NOTE(allen): Color functions
Scratch_Block scratch(app);
ARGB_Color color_function = fcolor_resolve(fcolor_id(defcolor_function));
ARGB_Color color_operator = fcolor_resolve(fcolor_id(defcolor_operator));
ARGB_Color color_type = fcolor_resolve(fcolor_id(defcolor_type));
ARGB_Color color_macro = fcolor_resolve(fcolor_id(defcolor_macro));
Token_Iterator_Array it = token_iterator_pos(0, &token_array, visible_range.first);
it.count = Min(it.count, visible_range.one_past_last - visible_range.first);
for (;;){
if (!token_it_inc_non_whitespace(&it)){
break;
}
ARGB_Color token_color = color_default;
Token *token = token_it_read(&it);
if (token->kind == TokenBaseKind_Operator ||
String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, token);
Code_Index_Note *note = code_index_note_from_string(lexeme);
if (note != 0)
{
switch (note->note_kind)
{
case CodeIndexNote_Type:
{
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color_type);
} break;
case CodeIndexNote_Function:
{
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color_function);
} break;
case CodeIndexNote_Macro:
{
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color_macro);
} break;
default: {} break;
}
}
else if (token->kind == TokenBaseKind_Operator ||
token->kind == TokenBaseKind_ScopeOpen ||
token->kind == TokenBaseKind_ScopeClose ||
token->kind == TokenBaseKind_ParentheticalOpen ||
token->kind == TokenBaseKind_ParentheticalClose ||
token->kind == TokenBaseKind_StatementClose)
{
token_color = color_operator;
}
else
{
String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, token);
Code_Index_Note *note = code_index_note_from_string(lexeme);
if (note != 0)
{
switch (note->note_kind)
{
case CodeIndexNote_Type: token_color = color_type; break;
case CodeIndexNote_Function: token_color = color_function; break;
case CodeIndexNote_Macro: token_color = color_macro; break;
default: {} break;
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color_operator);
}
}
}
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), token_color);
}
}
else
{
paint_text_color(app, text_layout_id, visible_range, color_default);
else{
paint_text_color_fcolor(app, text_layout_id, visible_range, fcolor_id(defcolor_text_default));
}
i64 cursor_pos = view_correct_cursor(app, view_id);