summaryrefslogtreecommitdiff
path: root/point.c
diff options
context:
space:
mode:
Diffstat (limited to 'point.c')
-rw-r--r--point.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/point.c b/point.c
index 27d62be..aef23ef 100644
--- a/point.c
+++ b/point.c
@@ -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) {