summaryrefslogtreecommitdiff
path: root/test/page.c
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-05-24 05:35:00 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-05-24 05:35:00 -0300
commit98280238383dc390207827d09dc92e0459229134 (patch)
treee2bc7c0877289165463dd6f9c2e77b570b22e29c /test/page.c
parentd37027bbd7ac13fdd0f1e2f01e1ec4b75b6c9588 (diff)
downloadjet-98280238383dc390207827d09dc92e0459229134.tar.gz
jet-98280238383dc390207827d09dc92e0459229134.zip
Rewrite in c++
Diffstat (limited to 'test/page.c')
-rw-r--r--test/page.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/test/page.c b/test/page.c
deleted file mode 100644
index f558fc6..0000000
--- a/test/page.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <curses.h>
-
-#define PAGE_SIZE 32
-#include "../page.c"
-
-int main() {
- int exit = 0;
- struct page *page = new_page();
-
- initscr();
- cbreak();
- noecho();
- nonl();
- intrflush(stdscr, FALSE);
- keypad(stdscr, TRUE);
-
- while (!exit) {
- clear();
-
- for (int i = 0; i < page->gap_start; i++) {
- addch(page->elements[i]);
- }
- for (int i = page->gap_start; i < page->gap_end; i++) {
- addch('.');
- }
- for (int i = page->gap_end; i < PAGE_SIZE; i++) {
- addch(page->elements[i]);
- }
-
- int input = getch();
- switch (input) {
- case KEY_LEFT:
- move_gap_backward(page);
- break;
- case KEY_RIGHT:
- move_gap_forward(page);
- break;
- case KEY_BACKSPACE:
- delete_at_gap(page);
- break;
- default:
- insert_at_gap(page, input);
- }
- }
-
- endwin();
- return 0;
-}