fix bug completion lors du multiligne et positionné sur une ligne != de la premiere
This commit is contained in:
parent
622d967ab8
commit
2e72ad114b
7 changed files with 27 additions and 9 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 09:14:30 by alao ### ########.fr */
|
/* Updated: 2017/03/17 16:40:10 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -185,5 +185,7 @@ char *path_solver(t_comp *c, char *cmd, char *cwd);
|
||||||
int c_exclusion_folder(t_comp *c);
|
int c_exclusion_folder(t_comp *c);
|
||||||
int ft_sstrlen(char **s);
|
int ft_sstrlen(char **s);
|
||||||
char *ft_sstrtostr(char **s, char *sep);
|
char *ft_sstrtostr(char **s, char *sep);
|
||||||
|
size_t ft_strlenw_i(char *str, size_t pos, char c);
|
||||||
|
size_t ft_strpos_i(char *str, size_t pos, char c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/10 11:37:43 by alao #+# #+# */
|
/* Created: 2017/01/10 11:37:43 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 08:27:50 by alao ### ########.fr */
|
/* Updated: 2017/03/17 16:46:20 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/09 11:21:16 by alao #+# #+# */
|
/* Created: 2017/01/09 11:21:16 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 08:30:52 by alao ### ########.fr */
|
/* Updated: 2017/03/17 16:51:46 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/16 22:17:10 by alao #+# #+# */
|
/* Created: 2017/02/16 22:17:10 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 08:08:19 by alao ### ########.fr */
|
/* Updated: 2017/03/17 16:51:53 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 08:48:05 by alao ### ########.fr */
|
/* Updated: 2017/03/17 16:48:49 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */
|
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/16 09:02:14 by alao ### ########.fr */
|
/* Updated: 2017/03/17 17:07:20 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -34,6 +34,22 @@ void c_term_clear(t_comp *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t c_virtual_position(t_comp *c)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
size_t pos;
|
||||||
|
size_t virtual_pos;
|
||||||
|
|
||||||
|
pos = c->ircmd;
|
||||||
|
virtual_pos = pos;
|
||||||
|
str = data_singleton()->line.input;
|
||||||
|
while (pos && str[pos] != '\n')
|
||||||
|
--pos;
|
||||||
|
if (str[pos] == '\n')
|
||||||
|
++pos;
|
||||||
|
return (virtual_pos - pos);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Move the terminal up by the number of line needed and move it back up to
|
** Move the terminal up by the number of line needed and move it back up to
|
||||||
** the original position.
|
** the original position.
|
||||||
|
|
@ -58,7 +74,7 @@ void c_term_mv_back(t_comp *c)
|
||||||
ft_putstr(tgetstr("cr", NULL));
|
ft_putstr(tgetstr("cr", NULL));
|
||||||
i = 0;
|
i = 0;
|
||||||
lcmd = 0;
|
lcmd = 0;
|
||||||
c->rcmd ? lcmd += c->ircmd + c->prompt + 1 : 0;
|
c->rcmd ? lcmd += c_virtual_position(c) + c->prompt + 1 : 0;
|
||||||
while (i < lcmd)
|
while (i < lcmd)
|
||||||
{
|
{
|
||||||
ft_putstr(tgetstr("nd", NULL));
|
ft_putstr(tgetstr("nd", NULL));
|
||||||
|
|
|
||||||
|
|
@ -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/17 12:13:41 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 17:22:02 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ int ft_completion(int ret, char **str, size_t *pos)
|
||||||
ft_current_str(*str, tmp);
|
ft_current_str(*str, tmp);
|
||||||
ft_get_next_str(*str, &tmp);
|
ft_get_next_str(*str, &tmp);
|
||||||
ft_putnc('\b', right);
|
ft_putnc('\b', right);
|
||||||
*pos = ft_strleni_w(*str, pos_tmp, '\n') - right;
|
*pos = pos_tmp + ft_strleni_w(*str, pos_tmp, '\n') - right;
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue