X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=render.c;h=ebaec937d08211d0ba36fe69bbce2fd0fd4ae352;hb=cb5385b932956072fc14fd6531c45f12c9cc4925;hp=c4812af1f126761f1f09480730c13eb9d798f9e3;hpb=30e6d7ecd064b2425f438293787a26d89781548b;p=taskasaur.git diff --git a/render.c b/render.c index c4812af..ebaec93 100644 --- a/render.c +++ b/render.c @@ -1,5 +1,6 @@ #include "headers/render.h" +#include #include "config.h" int init_tscolors(void); @@ -12,8 +13,7 @@ init_tscurses(void) { initscr(); cbreak(); - noecho(); - curs_set(0); + curs_off(); keypad(stdscr, TRUE); /* need to error check this */ @@ -50,6 +50,23 @@ init_tscolors(void) return 0; } +/* cursor */ +int +curs_on(void) +{ + echo(); + curs_set(1); + return 0; +} + +int +curs_off(void) +{ + noecho(); + curs_set(0); + return 0; +} + /* wins */ int create_todowin(void) @@ -60,3 +77,14 @@ create_todowin(void) return 0; } +int +ungetstr(char* str) +{ + // ignore null character (it's fine even if strlen = 0) + for (int i = strlen(str)-1; i >= 0; i--) { + ungetch(str[i]); + } + + return 0; +} +