From fff7a872e652a16f18b22c1b4fed96f24439e836 Mon Sep 17 00:00:00 2001 From: m600x Date: Fri, 3 Feb 2017 15:08:32 +0100 Subject: [PATCH] Pre-Merge --- 42sh/Makefile | 4 ++-- 42sh/includes/ft_readline.h | 3 ++- 42sh/src/completion/completion.c | 6 ++++-- 42sh/src/line-editing/get_touch.c | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/42sh/Makefile b/42sh/Makefile index 65248d51..89854d07 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/02/03 13:53:09 by alao ### ########.fr # +# Updated: 2017/02/03 15:01:26 by alao ### ########.fr # # # # **************************************************************************** # @@ -211,7 +211,7 @@ NB = $(words $(SRC_BASE)) INDEX = 0 all : - @make -j $(NAME) + @make $(NAME) $(NAME): $(LIBFT_LIB) $(OBJ_DIR) $(OBJS) @$(CC) $(FLAGS) $(D_FLAGS) \ diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index c79f8815..490724c7 100644 --- a/42sh/includes/ft_readline.h +++ b/42sh/includes/ft_readline.h @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ -/* Updated: 2017/02/02 18:28:44 by gwojda ### ########.fr */ +/* Updated: 2017/02/03 14:34:31 by alao ### ########.fr */ /* */ /* ************************************************************************** */ @@ -67,6 +67,7 @@ typedef struct s_line { char *input; char *copy_tmp; + char *input_tmp; size_t pos; int prompt_size; int list_size; diff --git a/42sh/src/completion/completion.c b/42sh/src/completion/completion.c index 284cca28..a6e72360 100644 --- a/42sh/src/completion/completion.c +++ b/42sh/src/completion/completion.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/09/20 14:50:33 by alao #+# #+# */ -/* Updated: 2017/02/03 14:11:42 by alao ### ########.fr */ +/* Updated: 2017/02/03 14:53:57 by alao ### ########.fr */ /* */ /* ************************************************************************** */ @@ -94,12 +94,14 @@ static int c_dispatcher(t_data *s) } /* -** Autocompletion feature. +** Autocompletion feature. +** ** If the structure of the completion (later called comp) doesn't exist, the ** function will check for a few things. If the current position is zero, it ** will return immediately. Same thing apply if the current position of the ** cursor is not a space. If those condition are not met the comp struct is ** created using c_init(). +** ** If the comp struct already exist at the call of the function, it will check ** which key has been pressed. If the tab key has been used, that mean an other ** item should be selected. This is done using c_next_item(). If the keypress diff --git a/42sh/src/line-editing/get_touch.c b/42sh/src/line-editing/get_touch.c index f0f2d1de..c1dd01e1 100644 --- a/42sh/src/line-editing/get_touch.c +++ b/42sh/src/line-editing/get_touch.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */ -/* Updated: 2017/02/03 13:05:41 by alao ### ########.fr */ +/* Updated: 2017/02/03 14:54:17 by alao ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,6 +49,8 @@ char *ft_read_stdin(void) if (data_singleton()->line.input[data_singleton()->line.pos]) ++(data_singleton()->line.pos); } +if (data_singleton()->comp) + c_clear(data_singleton()); while (42) { ret = 0;