diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index f08d88b2..c3dbf5e6 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/03/27 18:00:07 by gwojda ### ########.fr */ +/* Updated: 2017/03/29 17:41:14 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -135,6 +135,7 @@ int ft_get_size_prev(char *str, size_t pos); void sigwinch_resize(int sig); size_t ft_hist_len(void); int hist_is_delim(char c); +int ft_nb_last_line(char *str, size_t pos); int underline_right(char **str, size_t *pos, size_t pos_ref); int underline_left(char **str, size_t *pos, size_t pos_ref); diff --git a/42sh/src/line_editing/move_term/move_left_and_right.c b/42sh/src/line_editing/move_term/move_left_and_right.c index 6e95a076..ab7c9ca8 100644 --- a/42sh/src/line_editing/move_term/move_left_and_right.c +++ b/42sh/src/line_editing/move_term/move_left_and_right.c @@ -6,12 +6,23 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/19 16:43:58 by gwojda #+# #+# */ -/* Updated: 2017/03/17 11:51:32 by gwojda ### ########.fr */ +/* Updated: 2017/03/29 17:45:36 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +static void check_end_right(char *str, size_t pos) +{ + if (!str) + return ; + if (ft_nb_last_line(str, pos) == 0) + { + ft_putchar(str[pos]); + ft_puttermcaps("le"); + } +} + int ft_move_right(char **str, size_t *pos) { size_t tmp; @@ -36,6 +47,7 @@ int ft_move_right(char **str, size_t *pos) { ft_putchar((*str)[*pos]); ++(*pos); + check_end_right(*str, *pos); } return (0); }