summaryrefslogtreecommitdiff
path: root/test/page.c
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-22 10:48:30 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-22 10:48:30 -0300
commitf9eaf742d894b0e6d2c5b1bc244ba17bd00a9e85 (patch)
tree70d1a8fed23029bde7348467d92a93b2026cc065 /test/page.c
parent8b9d67da716c07f957eadd977059d74936c84a76 (diff)
downloadjet-f9eaf742d894b0e6d2c5b1bc244ba17bd00a9e85.tar.gz
jet-f9eaf742d894b0e6d2c5b1bc244ba17bd00a9e85.zip
Move operations on point structures to point.c
Diffstat (limited to 'test/page.c')
-rw-r--r--test/page.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/test/page.c b/test/page.c
deleted file mode 100644
index 0d4dd33..0000000
--- a/test/page.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <curses.h>
-
-#include "../page.c"
-
-int main() {
- int exit = 0;
- struct page *page = new_page();
- struct point point = {0};
- point.current_page = page;
-
- initscr();
- cbreak();
- noecho();
- nonl();
- intrflush(stdscr, FALSE);
- keypad(stdscr, TRUE);
-
- while (!exit) {
- clear();
-
- struct page *iter = page;
- while (iter) {
- addch('|');
- for (int i = 0; i < iter->gap_start; i++) {
- addch(iter->buffer[i]);
- }
- for (int i = iter->gap_start; i < iter->gap_end; i++) {
- addch('_');
- }
- for (int i = iter->gap_end; i < PAGE_SIZE; i++) {
- addch(iter->buffer[i]);
- }
- iter = iter->next;
- }
-
- int input = getch();
- switch (input) {
- case KEY_LEFT:
- move_point_backward(&point);
- break;
- case KEY_RIGHT:
- move_point_forward(&point);
- break;
- case KEY_BACKSPACE:
- delete_at_point(&point);
- break;
- default:
- insert_at_point(&point, input);
- }
- }
-
- endwin();
- return 0;
-}