diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-23 13:02:40 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-23 13:02:40 -0300 |
commit | a1a381926626aa44e264cd24dbf35e26f3d52330 (patch) | |
tree | 7e2af5d430e70903a4d8cb0202f667bb3d01f77b | |
parent | 88ca0bf25d072e73f31c0441b0ba05f403898b37 (diff) | |
download | jet-a1a381926626aa44e264cd24dbf35e26f3d52330.tar.gz jet-a1a381926626aa44e264cd24dbf35e26f3d52330.zip |
Fix not deleting at gap_start when not empty
-rw-r--r-- | point.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -65,7 +65,7 @@ void insert_at_point(struct point *point, uint8_t c) { } void delete_at_point(struct point *point) { - if (point->page->element_count == 0) { + if (point->page->element_count == 1) { if (point->page->prev) { point->page = point->page->prev; point->index = point->page->element_count; @@ -74,9 +74,14 @@ void delete_at_point(struct point *point) { point->page = point->page->next; point->index = 0; free_page(point->page->prev); + } else { + align_gap(point); + delete_at_gap(point->page); + move_point_backward(point); } + } else { + align_gap(point); + delete_at_gap(point->page); + move_point_backward(point); } - align_gap(point); - delete_at_gap(point->page); - move_point_backward(point); } |