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
|
NAME = 42sh
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror -g
|
FLAGS = -Wall -Wextra -Werror
|
||||||
D_FLAGS = -g
|
D_FLAGS = -g
|
||||||
|
|
||||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
|
/* 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);
|
ft_suppr(str, i);
|
||||||
else if (ret == TOUCHE_DELETE && (*str) && (*i) < ft_strlen((*str)))
|
else if (ret == TOUCHE_DELETE && (*str) && (*i) < ft_strlen((*str)))
|
||||||
ft_del(str, i);
|
ft_del(str, i);
|
||||||
else if (ret == TOUCHE_HOME && *str)
|
else if (ret == TOUCHE_HOME)
|
||||||
ft_home(*str, i);
|
ft_home(*str, i);
|
||||||
else if (ret == TOUCHE_END && *str)
|
else if (ret == TOUCHE_END)
|
||||||
ft_end(*str, i);
|
ft_end(*str, i);
|
||||||
else
|
else
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:42:54 by gwojda #+# #+# */
|
/* 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 (*str)
|
||||||
{
|
{
|
||||||
if (*pos)
|
if (*pos)
|
||||||
|
{
|
||||||
--(*pos);
|
--(*pos);
|
||||||
ft_get_beggin_with_curs(*str, pos);
|
ft_get_beggin_with_curs(*str, pos);
|
||||||
|
}
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
ft_strdel(str);
|
ft_strdel(str);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:43:58 by gwojda #+# #+# */
|
/* 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)
|
void ft_end(char *str, size_t *pos)
|
||||||
{
|
{
|
||||||
|
if (!str)
|
||||||
|
return ;
|
||||||
if (*pos)
|
if (*pos)
|
||||||
{
|
{
|
||||||
--(*pos);
|
--(*pos);
|
||||||
|
|
@ -35,6 +37,8 @@ void ft_end(char *str, size_t *pos)
|
||||||
|
|
||||||
void ft_home(char *str, size_t *pos)
|
void ft_home(char *str, size_t *pos)
|
||||||
{
|
{
|
||||||
|
if (!str)
|
||||||
|
return ;
|
||||||
if (*pos)
|
if (*pos)
|
||||||
{
|
{
|
||||||
--(*pos);
|
--(*pos);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */
|
/* 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;
|
(*pos) = (i && str[*pos - i] == '\n') ? *pos - i + 1 : *pos - i;
|
||||||
i = 0;
|
i = 0;
|
||||||
if (str[*pos - 1] == '\n')
|
if (*pos >= 1 && str[*pos - 1] == '\n')
|
||||||
{
|
{
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
(*pos) -= 2;
|
if (*pos >= 2)
|
||||||
|
(*pos) -= 2;
|
||||||
ft_get_beggin(str, pos);
|
ft_get_beggin(str, pos);
|
||||||
ft_current_str(str, *pos);
|
ft_current_str(str, *pos);
|
||||||
ft_get_next_str(str, pos);
|
ft_get_next_str(str, pos);
|
||||||
|
|
@ -80,12 +81,12 @@ void ft_found_prev_word(char *str, size_t *pos)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(str[*pos] == '\n' || str[*pos] == ' '))
|
if (*pos && !(str[*pos] == '\n' || str[*pos] == ' '))
|
||||||
{
|
{
|
||||||
ft_puttermcaps("le");
|
ft_puttermcaps("le");
|
||||||
--(*pos);
|
--(*pos);
|
||||||
}
|
}
|
||||||
while (str[*pos - i] == '\n' || str[*pos - i] == ' ')
|
while (*pos - i && (str[*pos - i] == '\n' || str[*pos - i] == ' '))
|
||||||
{
|
{
|
||||||
ft_puttermcaps("le");
|
ft_puttermcaps("le");
|
||||||
++i;
|
++i;
|
||||||
|
|
@ -123,7 +124,7 @@ void ft_found_next_word(char *str, size_t *pos)
|
||||||
}
|
}
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
ft_get_next_str(str, pos);
|
ft_get_next_str(str, pos);
|
||||||
(*pos) += 2;
|
(*pos) += (*pos) ? 2 : 1;
|
||||||
ft_current_str(str, *pos);
|
ft_current_str(str, *pos);
|
||||||
ft_get_next_str(str, pos);
|
ft_get_next_str(str, pos);
|
||||||
if (!str[*pos])
|
if (!str[*pos])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue