From 6fcf9534df7881d7d9822a85dba62b4efc6d9007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Fri, 8 May 2020 00:00:24 -0300 Subject: Add some color to point test --- test/point.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test/point.c') diff --git a/test/point.c b/test/point.c index 252726c..0902f47 100644 --- a/test/point.c +++ b/test/point.c @@ -10,21 +10,31 @@ int main() { struct point point = {page, 0}; initscr(); + start_color(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); +#define black 20 +#define red 21 +#define green 22 + init_color(black, 0, 0, 0); + init_color(red, 1000, 0, 0); + init_color(green, 0, 1000, 0); + init_pair(1, red, black); + init_pair(2, green, black); + while (!exit) { clear(); struct page *iter = page; while (iter) { if (iter == point.page) { - addch('#'); + attron(COLOR_PAIR(1)); } else { - addch('|'); + attron(COLOR_PAIR(2)); } for (int i = 0; i < iter->gap_start; i++) { addch(iter->elements[i]); @@ -36,10 +46,15 @@ int main() { addch(iter->elements[i]); } iter = iter->next; + attroff(COLOR_PAIR(1)); + attroff(COLOR_PAIR(2)); } int input = getch(); switch (input) { + case '': + exit = 1; + break; case KEY_LEFT: move_point_backward(&point); align_gap(&point); -- cgit v1.2.3