diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c_init.c | 17 | ||||
-rw-r--r-- | src/c_init.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/c_init.c b/src/c_init.c index 0c77224..f472f47 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -50,14 +50,21 @@ void c_process_key(t_caps *tcaps) { exit(0); else if (strncmp(nread, "l", 1) == 0) { - tputs(tgoto(tcaps->nd, 1, 1), 1, putchar); - /* write(1, tcaps->nd, strlen(tcaps->nd)); */ + /* tputs(tgoto(tcaps->nd, 1, 1), 1, putchar); */ + write(1, tcaps->nd, strlen(tcaps->nd)); } - else if (strncmp(nread, tcaps->cl, strlen(tcaps->cl)) == 0) + else if (strncmp(nread, "c", 1) == 0) write(1, tcaps->cl, strlen(tcaps->cl)); + else if (strncmp(nread, "j", 1) == 0) + write(1, tcaps->DO, strlen(tcaps->DO)); else if (strncmp(nread, "k", 1) == 0) { - write(1, tcaps->bc, strlen(tcaps->nd)); + write(1, tcaps->up, strlen(tcaps->kl)); + /* tputs(tgoto(tcaps->bc, 1, 1), 1, putchar); */ + } + else if (strncmp(nread, "h", 1) == 0) + { + write(1, tcaps->le, strlen(tcaps->le)); /* tputs(tgoto(tcaps->bc, 1, 1), 1, putchar); */ } else @@ -82,6 +89,8 @@ int16_t c_init_tcaps(void) tcaps.bc = tgetstr("bc", &term); tcaps.up = tgetstr("up", &term); tcaps.nd = tgetstr("nd", &term); + tcaps.le = tgetstr("le", &term); + tcaps.DO = tgetstr("do", &term); tcgetattr(STDIN_FILENO, &tcaps.tios); tcaps.tios.c_lflag &= ~(ECHO | ICANON); diff --git a/src/c_init.h b/src/c_init.h index 8cf43ec..1fe1b80 100644 --- a/src/c_init.h +++ b/src/c_init.h @@ -24,7 +24,9 @@ typedef struct s_caps { char *kr; char *pc; /*padding char --> do not touch (default 0)*/ char *bc; /*left one char*/ + char *le; /*left one char*/ char *up; /*up one line*/ + char *DO; /*down one line*/ char *nd; /*right one char*/ char *cl; /*line clear*/ |