summaryrefslogtreecommitdiff
path: root/page.c
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-22 20:23:46 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-22 20:23:46 -0300
commit4a29986fade6c81177dff812ddba69a598a010d8 (patch)
tree01203057a6e1d09bd32a82f88fef6914fe550225 /page.c
parentae003d1854021bdbc3128b2752198761d06772fd (diff)
downloadjet-4a29986fade6c81177dff812ddba69a598a010d8.tar.gz
jet-4a29986fade6c81177dff812ddba69a598a010d8.zip
Separate gap edition from point edition
Diffstat (limited to 'page.c')
-rw-r--r--page.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/page.c b/page.c
index 9a712ed..856cdfc 100644
--- a/page.c
+++ b/page.c
@@ -65,3 +65,16 @@ void move_gap_backward(struct page *page) {
page->gap_start--;
page->elements[page->gap_end] = page->elements[page->gap_start];
}
+
+void insert_at_gap(struct page *page, uint8_t c) {
+ page->elements[page->gap_start] = c;
+ page->gap_start++;
+ page->element_count++;
+}
+
+void delete_at_gap(struct page *page) {
+ if (page->gap_start) {
+ page->gap_start--;
+ page->element_count--;
+ }
+}