diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-26 00:19:13 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-26 00:19:13 -0300 |
commit | ef4d419989bcfe39f7ea7e50d4945c0ae24f2e85 (patch) | |
tree | 3b26682a8cbb18ba8d921d7f3d62aaaf73f3ee70 /point.c | |
parent | 7db6ffa2267a210cd7bbffa0c55f68656e396234 (diff) | |
download | jet-ef4d419989bcfe39f7ea7e50d4945c0ae24f2e85.tar.gz jet-ef4d419989bcfe39f7ea7e50d4945c0ae24f2e85.zip |
Fix element queries at page borders
Diffstat (limited to 'point.c')
-rw-r--r-- | point.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -15,11 +15,15 @@ uint16_t index_to_offset(struct point *point) { } uint8_t element(struct point *point) { - return point->page->elements[index_to_offset(point)]; + if (point->index == point->page->element_count) { + return point->page->next->elements[0]; + } else { + return point->page->elements[index_to_offset(point)]; + } } bool at_eof(struct point *point) { - return point->index == point->page->element_count; + return point->index == point->page->element_count && !point->page->next; } void move_point_forward(struct point *point) { |