diff options
Diffstat (limited to 'src/c_init.c')
| -rw-r--r-- | src/c_init.c | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/src/c_init.c b/src/c_init.c index 7296a2b..66e0541 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -66,9 +66,9 @@ c_read_cap(char *buf,  		   t_msh *msh)  {  		if ((*((unsigned int *)buf)) == LEFT_K) -			return (c_key_left(ft_strlen(line), ft_strlen(msh->ps[0]), tcaps)); +			return (c_key_left(ft_strlen(line), ft_strlen(msh->ps[tcaps->psx]), tcaps));  		else if ((*((unsigned int *)buf)) == RIGHT_K) -			return (c_key_right(ft_strlen(line), ft_strlen(msh->ps[0]), tcaps)); +			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) @@ -81,7 +81,7 @@ c_read_cap(char *buf,  			return (0);  } -char +static char  	*c_process_key(char *buf,  				t_caps *tcaps,  				t_msh *msh) @@ -102,17 +102,18 @@ char  		tcaps->cpos++;  	}  	else if ((*((unsigned int *)buf)) == DEL_K) -		c_back_slash(&line, ft_strlen(msh->ps[0]), tcaps); -	else if (buf[0] == '\n') -		return (c_new_line(line, tcaps, msh)); +		c_back_slash(&line, ft_strlen(msh->ps[tcaps->psx]), tcaps);  	else  		c_read_cap(buf, line, tcaps, msh); +	if (buf[0] == '\n') +		return (c_new_line(line, tcaps, msh));  	return (NULL);  }  int16_t  c_init_tcaps(int32_t fd,  			 char **line, +			 uint8_t psx,  			 t_msh *msh)  {  	t_caps tcaps; @@ -123,9 +124,9 @@ c_init_tcaps(int32_t fd,  	if (!tgetent(NULL, term))  		return (-1);  	c_get_struct(1, &tcaps); -	c_init_line(&tcaps); +	c_init_line(psx, &tcaps);  	tputs(tgetstr("cr", NULL), 1, ft_putchar); -	m_prompt_psx(1, msh); +	m_prompt_psx(psx, msh);  	ft_bzero(nread, 5);  	if (!(c_get_win_size(&tcaps.ws)))  		return (-1); | 
