Fix in the hack index -> character; all of those things need to be revisited for robustness and performance!
This commit is contained in:
parent
2f68a95fd5
commit
640481de56
|
@ -1016,6 +1016,13 @@ buffer_layout_character_from_pos(Buffer_Layout_Item_List list, i64 index){
|
||||||
i64 result = 0;
|
i64 result = 0;
|
||||||
i64 character_count = 0;
|
i64 character_count = 0;
|
||||||
i64 prev_index = -1;
|
i64 prev_index = -1;
|
||||||
|
if (index <= list.index_range.first){
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
else if (index > list.index_range.one_past_last){
|
||||||
|
result = list.character_count - 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
for (Buffer_Layout_Item_Block *node = list.first;
|
for (Buffer_Layout_Item_Block *node = list.first;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
|
@ -1032,6 +1039,7 @@ buffer_layout_character_from_pos(Buffer_Layout_Item_List list, i64 index){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
double_break:;
|
double_break:;
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue