diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-23 11:48:24 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-23 11:48:24 -0300 |
commit | 88ca0bf25d072e73f31c0441b0ba05f403898b37 (patch) | |
tree | ce22f5592847cc6dc212dbb3fa98a82e66c24a60 /point.c | |
parent | 388f43addc4a94681f27853defe9f46ec1b9ee63 (diff) | |
download | jet-88ca0bf25d072e73f31c0441b0ba05f403898b37.tar.gz jet-88ca0bf25d072e73f31c0441b0ba05f403898b37.zip |
Fix point movement bug
Diffstat (limited to 'point.c')
-rw-r--r-- | point.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -25,20 +25,20 @@ bool at_eof(struct point *point) { void move_point_forward(struct point *point) { if (point->index < point->page->element_count) { point->index++; - } - if (point->index == point->page->element_count && point->page->next) { - point->index = 0; + } else if (point->page->next) { + point->index = 1; point->page = point->page->next; } } void move_point_backward(struct point *point) { - if (point->index == 0 && point->page->prev) { + if (point->index > 1) { + point->index--; + } else if (point->page->prev) { point->index = point->page->prev->element_count; point->page = point->page->prev; - } - if (point->index > 0) { - point->index--; + } else { + point->index = 0; } } |