diff --git a/42sh/src/completion/c_find_files.c b/42sh/src/completion/c_find_files.c index ce521d43..bc621a50 100644 --- a/42sh/src/completion/c_find_files.c +++ b/42sh/src/completion/c_find_files.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:31:21 by alao #+# #+# */ -/* Updated: 2017/03/21 14:53:21 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 12:57:02 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -88,7 +88,7 @@ int c_seek_files(t_data *s, t_comp *c, char *current_word) if (c->rcmd[0] == '.') { c->cpath = ft_strdup("./"); - c->match = ft_strdup("."); + c->match = ft_strdup(current_word); } if (c->cpath == NULL) { diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index 09761b0f..e3f7b7ba 100644 --- a/42sh/src/completion/c_match.c +++ b/42sh/src/completion/c_match.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */ -/* Updated: 2017/03/22 12:44:00 by alao ### ########.fr */ +/* Updated: 2017/03/22 12:58:21 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,9 +49,11 @@ static char *c_current_words(t_comp *c) input_len = ft_strlen(data_singleton()->line.input); if (pos >= ft_strlen(c->rcmd)) pos = ft_strlen(c->rcmd) - (input_len - pos + 1); - while (pos && c->rcmd[pos] != ' ') + while (pos && c->rcmd[pos] != ' ' && c->rcmd[pos] != '<' + && c->rcmd[pos] != '>' && c->rcmd[pos] != '\n') --pos; - if (c->rcmd[pos] == ' ') + if (c->rcmd[pos] == ' ' || c->rcmd[pos] == '<' + || c->rcmd[pos] == '>' || c->rcmd[pos] == '\n') ++pos; return (c->rcmd + pos); }