diff options
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/c_init.c b/src/c_init.c index 69885fc..a77c326 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -59,16 +59,20 @@ int16_t } int16_t -c_read_cap(char *buf, char *line, t_caps *tcaps, t_msh *msh) + c_read_cap(char *buf, char *line, t_caps *tcaps, t_msh *msh) { - if (((*((unsigned int *)buf)) == LEFT_K) || ((*((unsigned int *)buf)) == CTRL_B)) + if (((*((unsigned int *)buf)) == LEFT_K) || + ((*((unsigned int *)buf)) == CTRL_B)) return (c_key_left(ft_strlen(msh->ps[tcaps->psx]), tcaps)); - else if (((*((unsigned int *)buf)) == RIGHT_K) || ((*((unsigned int *)buf)) == CTRL_F)) - return (c_key_right(ft_strlen(line), ft_strlen(msh->ps[tcaps->psx]), tcaps)); + else if (((*((unsigned int *)buf)) == RIGHT_K) || + ((*((unsigned int *)buf)) == CTRL_F)) + return (c_key_right(ft_strlen(line), + ft_strlen(msh->ps[tcaps->psx]), tcaps)); else if ((*((unsigned int *)buf)) == HOME_K) return (c_home_key(tcaps)); else if ((*((unsigned int *)buf)) == END_K) - return (c_end_key(ft_strlen(line), tcaps)); + return (c_end_key(ft_strlen(line), + ft_strlen(msh->ps[tcaps->psx]), tcaps)); else if ((*((unsigned int *)buf)) == CTRL_C) return (c_ctrl_c(NULL, tcaps, msh)); else if ((*((unsigned int *)buf)) == CTRL_L) @@ -80,8 +84,8 @@ c_read_cap(char *buf, char *line, t_caps *tcaps, t_msh *msh) static char *c_process_key(char *buf, t_caps *tcaps, t_msh *msh) { - static char *line = NULL; - int i; + static char *line = NULL; + int i; i = -1; if (line == NULL) @@ -112,11 +116,11 @@ static char } int16_t -c_gnl(int32_t fd, char **line, uint8_t psx, t_msh *msh) + c_gnl(int32_t fd, char **line, uint8_t psx, t_msh *msh) { - t_caps tcaps; - char *term; - char nread[5]; + t_caps tcaps; + char *term; + char nread[5]; term = getenv("TERM"); if (!tgetent(NULL, term)) |