diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-06 00:07:32 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-06 00:07:32 -0300 |
commit | e7117322149fdc0196acb49c2ae0ff32e2c299c0 (patch) | |
tree | da58f3b0b8f70d55aa93305d6f0ba526af1ea296 /test | |
parent | 5ac74ad3b03028343eec0b1616b4b5bd944d899d (diff) | |
download | jet-e7117322149fdc0196acb49c2ae0ff32e2c299c0.tar.gz jet-e7117322149fdc0196acb49c2ae0ff32e2c299c0.zip |
Fix text not rendering until first key press
Diffstat (limited to 'test')
-rw-r--r-- | test/page.c | 23 |
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(); |