summaryrefslogtreecommitdiffstats
path: root/src/c_keys_next.c
diff options
context:
space:
mode:
authorjoe <rbousset@42lyon.fr>2020-12-01 18:36:35 +0100
committerjoe <rbousset@42lyon.fr>2020-12-01 18:36:35 +0100
commit4f3d3364de8f1c23819051cb9f392fc651565b95 (patch)
treed7574f821dc02a27dcc5a0b8b63cf40e60dd023e /src/c_keys_next.c
parentBav (diff)
download42-minishell-4f3d3364de8f1c23819051cb9f392fc651565b95.tar.gz
42-minishell-4f3d3364de8f1c23819051cb9f392fc651565b95.tar.bz2
42-minishell-4f3d3364de8f1c23819051cb9f392fc651565b95.tar.xz
42-minishell-4f3d3364de8f1c23819051cb9f392fc651565b95.tar.zst
42-minishell-4f3d3364de8f1c23819051cb9f392fc651565b95.zip
commit
Diffstat (limited to 'src/c_keys_next.c')
-rw-r--r--src/c_keys_next.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/c_keys_next.c b/src/c_keys_next.c
index 629d9f8..ec063d3 100644
--- a/src/c_keys_next.c
+++ b/src/c_keys_next.c
@@ -17,30 +17,15 @@
#include "c_init.h"
#include "c_keys.h"
#include "d_define.h"
-#include "s_struct.h"
-short c_key_up(char *line[], t_caps *tcaps, t_msh *msh)
+void c_key_up_down(char *line[], t_caps *tcaps, char *ptr)
{
- char tmp[ARG_MAX];
- static char *ptr;
- static t_bool set = TRUE;
+ char tmp[ARG_MAX];
- if (set == TRUE)
- {
- ptr = msh->curr_hist_ptr + ft_strlen(msh->curr_hist_ptr);
- set = FALSE;
- }
- ptr -= 2;
- while (ptr - msh->curr_hist_ptr != 0 && *ptr != '\n')
- {
- ptr--;
- }
- ptr += 1;
c_home_key(tcaps->plen, tcaps);
ft_substr_s(tmp, ptr, 0, ft_strclen(ptr, '\n'));
ft_memdel((void*)&(*line));
tputs(tgetstr("ce", NULL), 1, ft_putchar);
*line = ft_strdup(tmp);
tcaps->cpos = ft_strlen(*line);
- return (1);
}