Reworked autocompletion multichoice
This commit is contained in:
parent
045b3c0226
commit
6ab0634d4c
3 changed files with 20 additions and 11 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/02/03 13:37:11 by alao ### ########.fr */
|
/* Updated: 2017/02/03 15:47:35 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ int c_sizing(t_comp *c);
|
||||||
** Output functions.
|
** Output functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int c_updater(t_comp *c);
|
int c_updater(t_comp *c, char *select);
|
||||||
int c_gtfo(t_comp *c, long int keypress);
|
int c_gtfo(t_comp *c, long int keypress);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -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/02/03 15:33:53 by gwojda ### ########.fr */
|
/* Updated: 2017/02/03 15:47:16 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,19 +20,19 @@
|
||||||
** Once that done, it will clear all the memory related and return zero.
|
** Once that done, it will clear all the memory related and return zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int c_updater(t_comp *c)
|
int c_updater(t_comp *c, char *select)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *rt;
|
char *rt;
|
||||||
int new_pos;
|
int new_pos;
|
||||||
|
|
||||||
DG("\tUpdater");
|
DG("\tUpdater");
|
||||||
DG("RCMD [%s] match [%s] Candidat [%s]", c->rcmd, c->match, c->lst->name);
|
DG("RCMD [%s] match [%s] Candidat [%s]", c->rcmd, c->match, select);
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
rt = NULL;
|
rt = NULL;
|
||||||
new_pos = c->ircmd + (ft_strlen(c->lst->name) - ft_strlen(c->match)) + 1;
|
new_pos = c->ircmd + (ft_strlen(select) - ft_strlen(c->match)) + 1;
|
||||||
tmp = ft_strsub(c->rcmd, 0, ft_strlen(c->rcmd) - ft_strlen(c->match));
|
tmp = ft_strsub(c->rcmd, 0, ft_strlen(c->rcmd) - ft_strlen(c->match));
|
||||||
rt = ft_strjoin(tmp, c->lst->name);
|
rt = ft_strjoin(tmp, select);
|
||||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||||
if (c->trail)
|
if (c->trail)
|
||||||
data_singleton()->line.input = ft_strjoin(rt, c->trail);
|
data_singleton()->line.input = ft_strjoin(rt, c->trail);
|
||||||
|
|
@ -52,7 +52,16 @@ int c_updater(t_comp *c)
|
||||||
|
|
||||||
int c_gtfo(t_comp *c, long int keypress)
|
int c_gtfo(t_comp *c, long int keypress)
|
||||||
{
|
{
|
||||||
|
t_clst *ptr;
|
||||||
|
|
||||||
DG("It's time to GTFO. Keypress [%d]", keypress);
|
DG("It's time to GTFO. Keypress [%d]", keypress);
|
||||||
(void)c;
|
if (keypress != 10)
|
||||||
return (0);
|
{
|
||||||
|
c_clear(data_singleton());
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
ptr = c->lst;
|
||||||
|
while (!ptr->cursor)
|
||||||
|
ptr = ptr->next;
|
||||||
|
return (c_updater(c, ptr->name));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
||||||
/* Updated: 2017/02/03 15:39:26 by gwojda ### ########.fr */
|
/* Updated: 2017/02/03 15:47:19 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ static int c_dispatcher(t_data *s)
|
||||||
c_clear(s);
|
c_clear(s);
|
||||||
}
|
}
|
||||||
else if (s->comp && s->comp->lst == s->comp->lst->next)
|
else if (s->comp && s->comp->lst == s->comp->lst->next)
|
||||||
return (c_updater(s->comp));
|
return (c_updater(s->comp, s->comp->lst->name));
|
||||||
else if (s->comp && s->comp->lst != s->comp->lst->next)
|
else if (s->comp && s->comp->lst != s->comp->lst->next)
|
||||||
{
|
{
|
||||||
c_term_mv_down(s->comp);
|
c_term_mv_down(s->comp);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue