summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-05-08 00:00:24 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-05-08 00:00:24 -0300
commit6fcf9534df7881d7d9822a85dba62b4efc6d9007 (patch)
treed295d53e64bdb742733fb14a69a34cdf4c7c7750 /test
parentfcc480d1592bebf474edc4b63f91d9251e4f1071 (diff)
downloadjet-6fcf9534df7881d7d9822a85dba62b4efc6d9007.tar.gz
jet-6fcf9534df7881d7d9822a85dba62b4efc6d9007.zip
Add some color to point test
Diffstat (limited to 'test')
-rw-r--r--test/point.c19
1 files changed, 17 insertions, 2 deletions
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);