sorry
This commit is contained in:
parent
974a896083
commit
a40577fce9
1 changed files with 67 additions and 0 deletions
67
42sh/src/line_editing/underline_function.c
Normal file
67
42sh/src/line_editing/underline_function.c
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* underline_function.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/22 20:55:24 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/22 20:56:54 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void underline_right(char **str, size_t *pos, size_t pos_ref)
|
||||
{
|
||||
if (!(*pos < ft_strlen(*str)))
|
||||
return ;
|
||||
if (*pos >= pos_ref)
|
||||
{
|
||||
ft_puttermcaps("mr");
|
||||
data_singleton()->line.copy_tmp = ft_realloc_imput(data_singleton()->
|
||||
line.copy_tmp, (*str)[*pos], data_singleton()->line.pos_tmp);
|
||||
ft_putchar((*str)[*pos]);
|
||||
ft_puttermcaps("me");
|
||||
++(data_singleton()->line.pos_tmp);
|
||||
++(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
data_singleton()->line.copy_tmp = ft_remove_imput(data_singleton()->
|
||||
line.copy_tmp, data_singleton()->line.pos_tmp);
|
||||
ft_putchar((*str)[*pos]);
|
||||
if (data_singleton()->line.pos_tmp)
|
||||
--(data_singleton()->line.pos_tmp);
|
||||
++(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
void underline_left(char **str, size_t *pos, size_t pos_ref)
|
||||
{
|
||||
if (!*pos)
|
||||
return ;
|
||||
if (*pos > pos_ref)
|
||||
{
|
||||
--(*pos);
|
||||
ft_putchar('\b');
|
||||
ft_putchar((*str)[*pos]);
|
||||
ft_putchar('\b');
|
||||
data_singleton()->line.copy_tmp = ft_remove_imput(data_singleton()->
|
||||
line.copy_tmp, data_singleton()->line.pos_tmp);
|
||||
if (data_singleton()->line.pos_tmp)
|
||||
--(data_singleton()->line.pos_tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
data_singleton()->line.pos_tmp = 0;
|
||||
--(*pos);
|
||||
ft_putchar('\b');
|
||||
ft_puttermcaps("mr");
|
||||
data_singleton()->line.copy_tmp = ft_realloc_imput(data_singleton()->
|
||||
line.copy_tmp, (*str)[*pos], data_singleton()->line.pos_tmp);
|
||||
ft_putchar((*str)[*pos]);
|
||||
ft_puttermcaps("me");
|
||||
ft_putchar('\b');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue