ajout control L

This commit is contained in:
gwojda 2017-03-05 19:41:13 +01:00
parent df7ed59b03
commit 21a2aca244
9 changed files with 90 additions and 39 deletions

View file

@ -6,7 +6,7 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
# Updated: 2017/02/17 17:16:16 by wescande ### ########.fr #
# Updated: 2017/03/04 17:27:41 by gwojda ### ########.fr #
# #
# **************************************************************************** #
@ -190,7 +190,7 @@ lexer/token_free.c\
lexer/token_init.c\
lexer/token_print.c\
line-editing/completion.c\
line-editing/control_c_and_d.c\
line-editing/control_features.c\
line-editing/copy_cut_paste.c\
line-editing/ft_prompt.c\
line-editing/get_key.c\

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */
/* Updated: 2017/02/16 12:44:23 by gwojda ### ########.fr */
/* Updated: 2017/03/05 19:37:38 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -37,6 +37,7 @@
# define TOUCHE_DELETE 2117294875
# define TOUCHE_CTRL_C 3
# define TOUCHE_CTRL_D 4
# define TOUCHE_CTRL_L 12
# define TOUCHE_CTRL_R 18
# define TOUCHE_SUPPR 127
# define TOUCHE_HOME 4741915
@ -52,20 +53,6 @@
# define TOUCHE_F5 892427035
# define TOUCHE_F6 925981467
/* # define PROMPT_QUOTES "quote> " */
/* # define PROMPT_DQUOTES "dquote> " */
/* # define PROMPT_BQUOTES "bquote> " */
/* # define PROMPT_ACCOLADE "cursh> " */
/* # define PROMPT_BRACKET "subsh> " */
/* # define PROMPT_BSLASH "> " */
/* # define SIZE_PROMPT_QUOTES 7 */
/* # define SIZE_PROMPT_DQUOTES 8 */
/* # define SIZE_PROMPT_BQUOTES 8 */
/* # define SIZE_PROMPT_ACCOLADE 7 */
/* # define SIZE_PROMPT_BRACKET 7 */
/* # define SIZE_PROMPT_BSLASH 2 */
# define IS_QUOTES (1 << 0)
# define IS_BQUOTES (1 << 1)
# define IS_DQUOTES (1 << 2)
@ -106,22 +93,7 @@ typedef struct s_key
void (*f)(void);
} t_key;
typedef struct s_prompt_type
{
char key;
int value;
char *new_prompt;
} t_prompt_type;
typedef struct s_brackets
{
int pos;
char tabl[100];
} t_brackets;
extern t_key g_keys[];
extern t_prompt_type g_prompt_tab[];
extern t_brackets g_brackets;
void ft_reset_tab(char *tabl);
void ft_putnc(char c, int n);
@ -152,6 +124,7 @@ char *ft_strget_history(char *str);
int ft_nb_last_line(char *str, size_t pos);
int ft_put(int nb);
void ft_check_line(void);
void ft_clear_window(void);
char *ft_read_stdin(void);
void ft_end(void);
@ -163,6 +136,7 @@ void ft_down(void);
void ft_buff_f6(void);
void ft_control_d(void);
void ft_control_c(void);
void ft_control_l(void);
void ft_del(void);
void ft_suppr(void);
void ft_print(int ret);

@ -1 +1 @@
Subproject commit 8f6e64fa9b4ac1dd3e3d5200fb93471ddfeedd40
Subproject commit bfc8ca207ab4d39f0140322c0f1d368137304a3c

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */
/* Updated: 2017/02/16 12:37:35 by gwojda ### ########.fr */
/* Updated: 2017/03/04 15:52:19 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* control_c_and_d.c :+: :+: :+: */
/* control_features.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */
/* Updated: 2017/02/14 14:08:21 by gwojda ### ########.fr */
/* Updated: 2017/03/05 19:36:56 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -41,3 +41,11 @@ void ft_control_c(void)
ft_strdel(&STR);
POS = 0;
}
void ft_control_l(void)
{
ft_clear_window();
ft_prompt();
ft_strdel(&STR);
POS = 0;
}

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
/* Updated: 2017/02/14 11:16:09 by gwojda ### ########.fr */
/* Updated: 2017/03/05 19:38:09 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,6 +19,7 @@ t_key g_key[] =
{FLECHE_GAUCHE , &ft_move_left },
{FLECHE_DROITE , &ft_move_right },
{TOUCHE_DELETE , &ft_del },
{TOUCHE_CTRL_L , &ft_control_l },
{TOUCHE_CTRL_C , &ft_control_c },
{TOUCHE_CTRL_D , &ft_control_d },
{TOUCHE_CTRL_R , &ft_surch_in_history },

View file

@ -6,13 +6,13 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/20 19:07:52 by gwojda #+# #+# */
/* Updated: 2017/02/05 17:06:07 by gwojda ### ########.fr */
/* Updated: 2017/03/05 19:36:44 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
static void ft_clear_window(void)
void ft_clear_window(void)
{
pid_t soon_pid;
char *tab_str[2];

3
42sh/test Normal file
View file

@ -0,0 +1,3 @@
 shell_init.c 28 interactive shell settings
 token_print.c 29 13:[ls]
 token_print.c 29 13:[ls]

65
42sh/testmake Normal file
View file

@ -0,0 +1,65 @@
 shell_init.c 28 interactive shell settings
 token_print.c 29 13:[ls]
 token_print.c 29 13:[if]
 token_print.c 29 13:[ls]
 token_print.c 29 13:[if ls
]
 token_print.c 29 13:[if ls
then pwd
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
then pwd
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
then pwd
fi
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
then pwd
fi
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
then pwd
fi
]
 token_print.c 29 13:[if ls
then pwd
Elif ls
Then pwd
Elif ls
then pwd
fi
]