correction de bugs sur les termcaps - normalement tu peux spammer wesande ! :p
This commit is contained in:
parent
12e92eec1a
commit
f03692e762
5 changed files with 20 additions and 13 deletions
|
|
@ -13,7 +13,7 @@
|
|||
NAME = 42sh
|
||||
|
||||
CC = gcc
|
||||
FLAGS = -Wall -Wextra -Werror -g
|
||||
FLAGS = -Wall -Wextra -Werror
|
||||
D_FLAGS = -g
|
||||
|
||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
|
||||
/* Updated: 2017/02/02 10:38:58 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/02/02 11:34:22 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,9 +18,9 @@ static int ft_lecture_3(int ret, char **str, size_t *i)
|
|||
ft_suppr(str, i);
|
||||
else if (ret == TOUCHE_DELETE && (*str) && (*i) < ft_strlen((*str)))
|
||||
ft_del(str, i);
|
||||
else if (ret == TOUCHE_HOME && *str)
|
||||
else if (ret == TOUCHE_HOME)
|
||||
ft_home(*str, i);
|
||||
else if (ret == TOUCHE_END && *str)
|
||||
else if (ret == TOUCHE_END)
|
||||
ft_end(*str, i);
|
||||
else
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/19 16:42:54 by gwojda #+# #+# */
|
||||
/* Updated: 2017/02/01 16:45:22 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/02/02 11:41:52 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,8 +18,10 @@ void ft_history_2(char **str, int ret, t_list_history **head
|
|||
if (*str)
|
||||
{
|
||||
if (*pos)
|
||||
{
|
||||
--(*pos);
|
||||
ft_get_beggin_with_curs(*str, pos);
|
||||
ft_get_beggin_with_curs(*str, pos);
|
||||
}
|
||||
ft_puttermcaps("cd");
|
||||
*pos = 0;
|
||||
ft_strdel(str);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/19 16:43:58 by gwojda #+# #+# */
|
||||
/* Updated: 2017/02/01 15:29:20 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/02/02 11:34:34 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,6 +20,8 @@ int ft_put(int nb)
|
|||
|
||||
void ft_end(char *str, size_t *pos)
|
||||
{
|
||||
if (!str)
|
||||
return ;
|
||||
if (*pos)
|
||||
{
|
||||
--(*pos);
|
||||
|
|
@ -35,6 +37,8 @@ void ft_end(char *str, size_t *pos)
|
|||
|
||||
void ft_home(char *str, size_t *pos)
|
||||
{
|
||||
if (!str)
|
||||
return ;
|
||||
if (*pos)
|
||||
{
|
||||
--(*pos);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */
|
||||
/* Updated: 2017/02/02 11:01:10 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/02/02 11:46:55 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -69,10 +69,11 @@ void ft_found_prev_word(char *str, size_t *pos)
|
|||
}
|
||||
(*pos) = (i && str[*pos - i] == '\n') ? *pos - i + 1 : *pos - i;
|
||||
i = 0;
|
||||
if (str[*pos - 1] == '\n')
|
||||
if (*pos >= 1 && str[*pos - 1] == '\n')
|
||||
{
|
||||
ft_puttermcaps("cd");
|
||||
(*pos) -= 2;
|
||||
if (*pos >= 2)
|
||||
(*pos) -= 2;
|
||||
ft_get_beggin(str, pos);
|
||||
ft_current_str(str, *pos);
|
||||
ft_get_next_str(str, pos);
|
||||
|
|
@ -80,12 +81,12 @@ void ft_found_prev_word(char *str, size_t *pos)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!(str[*pos] == '\n' || str[*pos] == ' '))
|
||||
if (*pos && !(str[*pos] == '\n' || str[*pos] == ' '))
|
||||
{
|
||||
ft_puttermcaps("le");
|
||||
--(*pos);
|
||||
}
|
||||
while (str[*pos - i] == '\n' || str[*pos - i] == ' ')
|
||||
while (*pos - i && (str[*pos - i] == '\n' || str[*pos - i] == ' '))
|
||||
{
|
||||
ft_puttermcaps("le");
|
||||
++i;
|
||||
|
|
@ -123,7 +124,7 @@ void ft_found_next_word(char *str, size_t *pos)
|
|||
}
|
||||
ft_puttermcaps("cd");
|
||||
ft_get_next_str(str, pos);
|
||||
(*pos) += 2;
|
||||
(*pos) += (*pos) ? 2 : 1;
|
||||
ft_current_str(str, *pos);
|
||||
ft_get_next_str(str, pos);
|
||||
if (!str[*pos])
|
||||
|
|
|
|||
Loading…
Reference in a new issue