switch Found_String to use Range

This commit is contained in:
Allen Webster 2019-03-30 13:30:51 -07:00
parent 5029512554
commit 1e67e5a3c5
2 changed files with 5 additions and 6 deletions

View File

@ -1247,8 +1247,7 @@ STRUCT Found_String{
u32 flags; u32 flags;
i32 string_id; i32 string_id;
i32 start; Range location;
i32 end;
}; };
// TODO(casey): If this sticks around, there should be a way to export add/remove/merge as inlines that are shared // TODO(casey): If this sticks around, there should be a way to export add/remove/merge as inlines that are shared

View File

@ -4527,7 +4527,7 @@ Find_All_In_Range_Insensitive(Application_Links *app, Buffer_ID buffer_id, i32 s
while(*partial) while(*partial)
{ {
Found_String *check = *partial; Found_String *check = *partial;
i32 trailing_char_at = ((check->start + key.size) - check->end); i32 trailing_char_at = ((check->location.start + key.size) - check->location.end);
i32 remaining = trailing_char_at; i32 remaining = trailing_char_at;
b32 valid = true; b32 valid = true;
b32 full = true; b32 full = true;
@ -4555,7 +4555,7 @@ Find_All_In_Range_Insensitive(Application_Links *app, Buffer_ID buffer_id, i32 s
break; break;
} }
} }
check->end += remaining; check->location.end += remaining;
if(valid) if(valid)
{ {
@ -4643,8 +4643,8 @@ Find_All_In_Range_Insensitive(Application_Links *app, Buffer_ID buffer_id, i32 s
found->buffer_id = buffer_id; found->buffer_id = buffer_id;
found->flags = FoundString_Insensitive | exact_matched | clean_edegs; found->flags = FoundString_Insensitive | exact_matched | clean_edegs;
found->string_id = 0; found->string_id = 0;
found->start = i + at; found->location.start = i + at;
found->end = found->start + remaining; found->location.end = found->location.start + remaining;
// NOTE(casey): Although technically "full matches" are full, we haven't yet checked the trailing edge for tokenization, // NOTE(casey): Although technically "full matches" are full, we haven't yet checked the trailing edge for tokenization,
// so we need to shunt to partial in the cases where we _can't_ check the overhanging character. // so we need to shunt to partial in the cases where we _can't_ check the overhanging character.