change ret line editing
This commit is contained in:
parent
037f968183
commit
934991beb4
15 changed files with 61 additions and 61 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */
|
/* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:00:08 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:48:21 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ int ft_history_down(void)
|
||||||
|
|
||||||
head = data_singleton()->line.list_cur;
|
head = data_singleton()->line.list_cur;
|
||||||
if (!head)
|
if (!head)
|
||||||
return (1);
|
return (0);
|
||||||
ft_clear_before_history(&STR);
|
ft_clear_before_history(&STR);
|
||||||
if (head->next)
|
if (head->next)
|
||||||
head = head->next;
|
head = head->next;
|
||||||
|
|
@ -49,7 +49,7 @@ int ft_history_down(void)
|
||||||
else
|
else
|
||||||
POS = 0;
|
POS = 0;
|
||||||
data_singleton()->line.list_cur = head;
|
data_singleton()->line.list_cur = head;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_history_up(void)
|
int ft_history_up(void)
|
||||||
|
|
@ -58,7 +58,7 @@ int ft_history_up(void)
|
||||||
|
|
||||||
head = data_singleton()->line.list_cur;
|
head = data_singleton()->line.list_cur;
|
||||||
if (!head)
|
if (!head)
|
||||||
return (1);
|
return (0);
|
||||||
ft_clear_before_history(&STR);
|
ft_clear_before_history(&STR);
|
||||||
if (head->prev)
|
if (head->prev)
|
||||||
head = head->prev;
|
head = head->prev;
|
||||||
|
|
@ -74,5 +74,5 @@ int ft_history_up(void)
|
||||||
else
|
else
|
||||||
POS = 0;
|
POS = 0;
|
||||||
data_singleton()->line.list_cur = head;
|
data_singleton()->line.list_cur = head;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/25 11:39:47 by gwojda #+# #+# */
|
/* Created: 2017/01/25 11:39:47 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:09:02 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:48:34 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ int ft_history_parsing(int has_prompt, char **input)
|
||||||
i = 0;
|
i = 0;
|
||||||
boolean = 0;
|
boolean = 0;
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
while (STR && STR[i])
|
while (STR && STR[i])
|
||||||
{
|
{
|
||||||
if (STR[i] == '!')
|
if (STR[i] == '!')
|
||||||
|
|
@ -83,5 +83,5 @@ int ft_history_parsing(int has_prompt, char **input)
|
||||||
}
|
}
|
||||||
if (boolean)
|
if (boolean)
|
||||||
return (readline(has_prompt, input));
|
return (readline(has_prompt, input));
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/26 10:43:16 by gwojda #+# #+# */
|
/* Created: 2017/01/26 10:43:16 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:12:05 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:48:06 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -92,5 +92,5 @@ int ft_surch_in_history(void)
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
ft_modify_str(str_srch, srch_pos);
|
ft_modify_str(str_srch, srch_pos);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 14:15:55 by gwojda #+# #+# */
|
/* Created: 2017/02/03 14:15:55 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 10:33:10 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:45:06 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -53,5 +53,5 @@ int ft_completion(int ret)
|
||||||
ft_putnc('\b', right);
|
ft_putnc('\b', right);
|
||||||
POS = ft_strleni_w(STR, pos_tmp, '\n') - right;
|
POS = ft_strleni_w(STR, pos_tmp, '\n') - right;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */
|
/* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 16:45:43 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:45:20 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ int ft_buff_f6(void)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (read(0, &ret, sizeof(int)) < 0)
|
if (read(0, &ret, sizeof(int)) < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_control_d(void)
|
int ft_control_d(void)
|
||||||
|
|
@ -34,7 +34,7 @@ int ft_control_d(void)
|
||||||
ft_del();
|
ft_del();
|
||||||
else
|
else
|
||||||
ft_puttermcaps("bl");
|
ft_puttermcaps("bl");
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_control_c(void)
|
int ft_control_c(void)
|
||||||
|
|
@ -55,5 +55,5 @@ int ft_control_l(void)
|
||||||
ft_prompt();
|
ft_prompt();
|
||||||
ft_strdel(&STR);
|
ft_strdel(&STR);
|
||||||
POS = 0;
|
POS = 0;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 12:45:06 by gwojda #+# #+# */
|
/* Created: 2016/12/19 12:45:06 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:12:40 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:45:37 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ int ft_v(void)
|
||||||
i = -1;
|
i = -1;
|
||||||
tmp_pos = POS;
|
tmp_pos = POS;
|
||||||
if (!STR || !tmp)
|
if (!STR || !tmp)
|
||||||
return (1);
|
return (0);
|
||||||
while (tmp[++i])
|
while (tmp[++i])
|
||||||
if (!(STR = ft_realloc_imput(STR, tmp[i], POS + i)))
|
if (!(STR = ft_realloc_imput(STR, tmp[i], POS + i)))
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
@ -60,7 +60,7 @@ int ft_v(void)
|
||||||
ft_get_next_str(STR, &POS);
|
ft_get_next_str(STR, &POS);
|
||||||
ft_putnc('\b', POS - tmp_pos);
|
ft_putnc('\b', POS - tmp_pos);
|
||||||
POS = tmp_pos;
|
POS = tmp_pos;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_x(void)
|
int ft_x(void)
|
||||||
|
|
@ -70,7 +70,7 @@ int ft_x(void)
|
||||||
|
|
||||||
tmp = &data_singleton()->line.copy_tmp;
|
tmp = &data_singleton()->line.copy_tmp;
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
if (*tmp)
|
if (*tmp)
|
||||||
ft_strdel(tmp);
|
ft_strdel(tmp);
|
||||||
if (!(*tmp = ft_strdupi_space(&STR[POS])))
|
if (!(*tmp = ft_strdupi_space(&STR[POS])))
|
||||||
|
|
@ -83,7 +83,7 @@ int ft_x(void)
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_c(void)
|
int ft_c(void)
|
||||||
|
|
@ -97,5 +97,5 @@ int ft_c(void)
|
||||||
ft_strdel(tmp);
|
ft_strdel(tmp);
|
||||||
if (!(*tmp = ft_strdupi_space(STR + POS)))
|
if (!(*tmp = ft_strdupi_space(STR + POS)))
|
||||||
return (-1);
|
return (-1);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/03/16 17:13:48 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:49:59 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ int ft_read_stdin(char **input)
|
||||||
++j;
|
++j;
|
||||||
if (g_key[j].value)
|
if (g_key[j].value)
|
||||||
{
|
{
|
||||||
if ((ret = g_key[j].f()) != 1)
|
if ((ret = g_key[j].f()))
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
else if (ft_isprint(ret))
|
else if (ft_isprint(ret))
|
||||||
|
|
@ -77,7 +77,7 @@ int ft_read_stdin(char **input)
|
||||||
else if (ret == 10)
|
else if (ret == 10)
|
||||||
{
|
{
|
||||||
*input = STR;
|
*input = STR;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
else if (ft_isascii(ret) == 0)
|
else if (ft_isascii(ret) == 0)
|
||||||
ft_read_it(ret, &POS, &STR);
|
ft_read_it(ret, &POS, &STR);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/14 11:13:24 by gwojda #+# #+# */
|
/* Created: 2017/02/14 11:13:24 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:14:07 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:46:05 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
int ft_end(void)
|
int ft_end(void)
|
||||||
{
|
{
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
if (POS)
|
if (POS)
|
||||||
{
|
{
|
||||||
--POS;
|
--POS;
|
||||||
|
|
@ -27,13 +27,13 @@ int ft_end(void)
|
||||||
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);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_home(void)
|
int ft_home(void)
|
||||||
{
|
{
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
if (POS)
|
if (POS)
|
||||||
{
|
{
|
||||||
--POS;
|
--POS;
|
||||||
|
|
@ -49,5 +49,5 @@ int ft_home(void)
|
||||||
if (!STR[POS])
|
if (!STR[POS])
|
||||||
--POS;
|
--POS;
|
||||||
ft_get_beggin_with_curs(STR, &POS);
|
ft_get_beggin_with_curs(STR, &POS);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/03/16 17:15:21 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:46:27 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ int ft_move_right(void)
|
||||||
size_t tmp;
|
size_t tmp;
|
||||||
|
|
||||||
if (ft_strlen(STR) <= POS)
|
if (ft_strlen(STR) <= POS)
|
||||||
return (1);
|
return (0);
|
||||||
if (STR[POS] == '\n')
|
if (STR[POS] == '\n')
|
||||||
{
|
{
|
||||||
if (POS)
|
if (POS)
|
||||||
|
|
@ -37,20 +37,20 @@ int ft_move_right(void)
|
||||||
ft_putchar(STR[POS]);
|
ft_putchar(STR[POS]);
|
||||||
++POS;
|
++POS;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_move_left(void)
|
int ft_move_left(void)
|
||||||
{
|
{
|
||||||
if (!POS)
|
if (!POS)
|
||||||
return (1);
|
return (0);
|
||||||
if (STR[POS - 1] == '\n')
|
if (STR[POS - 1] == '\n')
|
||||||
{
|
{
|
||||||
if (POS - 1 == 0)
|
if (POS - 1 == 0)
|
||||||
{
|
{
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
--POS;
|
--POS;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
POS -= 2;
|
POS -= 2;
|
||||||
|
|
@ -66,5 +66,5 @@ int ft_move_left(void)
|
||||||
ft_puttermcaps("le");
|
ft_puttermcaps("le");
|
||||||
--POS;
|
--POS;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/14 11:12:09 by gwojda #+# #+# */
|
/* Created: 2017/02/14 11:12:09 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 16:48:48 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:46:44 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ int ft_found_prev_word(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!POS || !STR)
|
if (!POS || !STR)
|
||||||
return (1);
|
return (0);
|
||||||
ft_init_prev_word(&POS, STR);
|
ft_init_prev_word(&POS, STR);
|
||||||
if (POS >= 1 && STR[POS - 1] == '\n')
|
if (POS >= 1 && STR[POS - 1] == '\n')
|
||||||
{
|
{
|
||||||
|
|
@ -69,7 +69,7 @@ int ft_found_prev_word(void)
|
||||||
{
|
{
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
--POS;
|
--POS;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
POS -= 2;
|
POS -= 2;
|
||||||
|
|
@ -82,7 +82,7 @@ int ft_found_prev_word(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ft_found_prev_word_2(i, STR, &POS);
|
ft_found_prev_word_2(i, STR, &POS);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ft_found_next_word_2(void)
|
static void ft_found_next_word_2(void)
|
||||||
|
|
@ -108,7 +108,7 @@ int ft_found_next_word(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
while (STR[i + POS] && STR[i + POS] == ' ')
|
while (STR[i + POS] && STR[i + POS] == ' ')
|
||||||
{
|
{
|
||||||
ft_putchar(STR[i + POS]);
|
ft_putchar(STR[i + POS]);
|
||||||
|
|
@ -125,5 +125,5 @@ int ft_found_next_word(void)
|
||||||
}
|
}
|
||||||
POS += i;
|
POS += i;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/09 13:21:40 by gwojda #+# #+# */
|
/* Created: 2017/01/09 13:21:40 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 16:49:34 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:46:55 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ static void ft_up_2(size_t *pos, char *str)
|
||||||
int ft_up(void)
|
int ft_up(void)
|
||||||
{
|
{
|
||||||
if (!STR || !POS)
|
if (!STR || !POS)
|
||||||
return (1);
|
return (0);
|
||||||
if (STR[POS - 1] == '\n')
|
if (STR[POS - 1] == '\n')
|
||||||
{
|
{
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
|
|
@ -54,7 +54,7 @@ int ft_up(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ft_up_2(&POS, STR);
|
ft_up_2(&POS, STR);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ft_down_2(size_t *pos, char *str)
|
static void ft_down_2(size_t *pos, char *str)
|
||||||
|
|
@ -81,7 +81,7 @@ int ft_down(void)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!STR)
|
if (!STR)
|
||||||
return (1);
|
return (0);
|
||||||
if (STR[POS] == '\n')
|
if (STR[POS] == '\n')
|
||||||
ft_down_2(&POS, STR);
|
ft_down_2(&POS, STR);
|
||||||
else
|
else
|
||||||
|
|
@ -94,5 +94,5 @@ int ft_down(void)
|
||||||
}
|
}
|
||||||
POS += i;
|
POS += i;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/05 16:02:43 by gwojda #+# #+# */
|
/* Created: 2017/01/05 16:02:43 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:15:41 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:47:11 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ int ft_print(int ret)
|
||||||
ft_check_end_of_line(STR, POS + j);
|
ft_check_end_of_line(STR, POS + j);
|
||||||
ft_putnc('\b', j - 1);
|
ft_putnc('\b', j - 1);
|
||||||
++POS;
|
++POS;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ft_suppr_2(char **str, size_t *i, size_t tmp)
|
static void ft_suppr_2(char **str, size_t *i, size_t tmp)
|
||||||
|
|
@ -61,7 +61,7 @@ int ft_suppr(void)
|
||||||
|
|
||||||
boolean = 0;
|
boolean = 0;
|
||||||
if (POS <= 0)
|
if (POS <= 0)
|
||||||
return (1);
|
return (0);
|
||||||
if (STR[POS - 1] != '\n')
|
if (STR[POS - 1] != '\n')
|
||||||
boolean = 1;
|
boolean = 1;
|
||||||
--POS;
|
--POS;
|
||||||
|
|
@ -79,7 +79,7 @@ int ft_suppr(void)
|
||||||
ft_get_beggin(STR, &POS);
|
ft_get_beggin(STR, &POS);
|
||||||
}
|
}
|
||||||
ft_suppr_2(&STR, &POS, tmp);
|
ft_suppr_2(&STR, &POS, tmp);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_del(void)
|
int ft_del(void)
|
||||||
|
|
@ -90,7 +90,7 @@ int ft_del(void)
|
||||||
if (!(STR = ft_remove_imput(STR, tmp)))
|
if (!(STR = ft_remove_imput(STR, tmp)))
|
||||||
return (-1);
|
return (-1);
|
||||||
if (!(STR && POS < ft_strlen(STR) + 1))
|
if (!(STR && POS < ft_strlen(STR) + 1))
|
||||||
return (1);
|
return (0);
|
||||||
if (POS)
|
if (POS)
|
||||||
{
|
{
|
||||||
--POS;
|
--POS;
|
||||||
|
|
@ -103,5 +103,5 @@ int ft_del(void)
|
||||||
++POS;
|
++POS;
|
||||||
ft_putnc('\b', POS - tmp);
|
ft_putnc('\b', POS - tmp);
|
||||||
POS = tmp;
|
POS = tmp;
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:52:57 by gwojda #+# #+# */
|
/* Created: 2016/12/19 16:52:57 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:15:56 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:47:31 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ static int ft_read_it_3(char **str, char t[5], size_t *pos, int *j)
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ft_read_it_2(int input, char t[5])
|
static void ft_read_it_2(int input, char t[5])
|
||||||
|
|
@ -62,16 +62,16 @@ int ft_read_it(int input, size_t *pos, char **str)
|
||||||
input == 126 || input == 993090331 || input == 925981467 ||
|
input == 126 || input == 993090331 || input == 925981467 ||
|
||||||
input == 21298 || input == 892427035 || input == 8270395 || input ==
|
input == 21298 || input == 892427035 || input == 8270395 || input ==
|
||||||
942758683 || input == 993090331 || input == 18489 || input == 17977)
|
942758683 || input == 993090331 || input == 18489 || input == 17977)
|
||||||
return (1);
|
return (0);
|
||||||
ft_read_it_2(input, t);
|
ft_read_it_2(input, t);
|
||||||
if (ft_read_it_3(str, t, pos, &j) < 0)
|
if (ft_read_it_3(str, t, pos, &j) < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (!*str)
|
if (!*str)
|
||||||
return (1);
|
return (0);
|
||||||
*pos = pos_tmp;
|
*pos = pos_tmp;
|
||||||
ft_current_str((*str), *pos);
|
ft_current_str((*str), *pos);
|
||||||
ft_get_next_str((*str), pos);
|
ft_get_next_str((*str), pos);
|
||||||
ft_putnc('\b', *pos - (pos_tmp + j));
|
ft_putnc('\b', *pos - (pos_tmp + j));
|
||||||
*pos = (pos_tmp + j);
|
*pos = (pos_tmp + j);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 17:08:28 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 10:51:27 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ int readline(int has_prompt, char **input)
|
||||||
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
|
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
|
||||||
readline_init(has_prompt);
|
readline_init(has_prompt);
|
||||||
ret = ft_read_stdin(input);
|
ret = ft_read_stdin(input);
|
||||||
if (ret <= 0)
|
if (ret < 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
if (STR)
|
if (STR)
|
||||||
ft_current_str(STR, POS);
|
ft_current_str(STR, POS);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/16 15:45:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/17 10:51:23 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue