42-archive/42sh/srcs/line-editing/rl_remove_function.c
2017-01-26 19:24:00 +01:00

39 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rl_remove_function.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 12:45:08 by sbenning #+# #+# */
/* Updated: 2016/12/12 12:46:39 by sbenning ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_readline.h"
int rl_retarr_function(t_line *line, long int input)
{
if (RL_IS(line->bitset, RL_SELECT))
RL_UNSET(line->bitset, RL_SELECT);
if (!line->pos)
return (0);
input_remove(line, 1);
curs_backward(&line->curs, 1);
line->pos -= 1;
rl_reset_display_post(line);
return (0);
(void)input;
}
int rl_suppr_function(t_line *line, long int input)
{
if (RL_IS(line->bitset, RL_SELECT))
RL_UNSET(line->bitset, RL_SELECT);
if (line->pos == line->used)
return (0);
input_remove(line, -1);
rl_reset_display_post(line);
return (0);
(void)input;
}