summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/page.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/page.c b/test/page.c
index 322adf2..8dd2c90 100644
--- a/test/page.c
+++ b/test/page.c
@@ -14,6 +14,18 @@ int main() {
keypad(stdscr, TRUE);
while (!exit) {
+ int gap_start = p->gap_start - p->buffer;
+ int gap_end = p->gap_end - p->buffer;
+ for (int i = 0; i < gap_start; i++) {
+ addch(p->buffer[i]);
+ }
+ for (int i = gap_start; i < gap_end; i++) {
+ addch('_');
+ }
+ for (int i = gap_end; i < PAGE_SIZE; i++) {
+ addch(p->buffer[i]);
+ }
+
int input = getch();
clear();
switch (input) {
@@ -29,17 +41,6 @@ int main() {
default:
insert_into_page(p, input);
}
- int gap_start = p->gap_start - p->buffer;
- int gap_end = p->gap_end - p->buffer;
- for (int i = 0; i < gap_start; i++) {
- addch(p->buffer[i]);
- }
- for (int i = gap_start; i < gap_end; i++) {
- addch('_');
- }
- for (int i = gap_end; i < PAGE_SIZE; i++) {
- addch(p->buffer[i]);
- }
}
endwin();