diff options
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/c_init.c b/src/c_init.c index 2718ac8..196a8ff 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -74,10 +74,10 @@ static int16_t ((*((unsigned int *)buf)) == CTRL_F)) return (c_key_right(ft_strlen(line), plen, tcaps)); else if (((*((unsigned int *)buf)) == HOME_K) || - ((*((unsigned int *)buf)) == CTRL_A)) + ((*((unsigned int *)buf)) == CTRL_A)) return (c_home_key(plen, tcaps)); else if (((*((unsigned int *)buf)) == END_K) || - ((*((unsigned int *)buf)) == CTRL_E)) + ((*((unsigned int *)buf)) == CTRL_E)) return (c_end_key(ft_strlen(line), plen, tcaps)); else if ((*((unsigned int *)buf)) == CTRL_L) return (c_ctrl_l(line, tcaps, msh)); @@ -113,26 +113,19 @@ static char c_redraw_line(line, tcaps, msh); } else - if (c_read_cap(buf, line, tcaps, msh) == 130) - { - return (c_new_line(ft_strdup("\n"), tcaps)); - } - if (buf[0] == '\n') - return (c_new_line(line, tcaps)); - return (NULL); + { + return ((c_read_cap(buf, line, tcaps, msh) == 130) ? + c_new_line(ft_strdup("\n"), tcaps) : NULL); + } + return ((buf[0] == '\n') ? c_new_line(line, tcaps) : NULL); } int16_t c_gnl(int32_t fd, char **line, uint8_t psx, t_msh *msh) { t_caps tcaps; - char *term; char nread[5]; - term = getenv("TERM"); - signal(SIGINT, SIG_DFL); - if (!tgetent(NULL, term)) - return (-1); c_init_line(psx, &tcaps); tputs(tgetstr("cr", NULL), 1, ft_putchar); m_prompt_psx(psx, msh); |