fix bug completion resize sur fenetre minuscule

This commit is contained in:
gwojda 2017-03-15 14:40:19 +01:00
parent bcf72b5bd2
commit 39d5b25084
14 changed files with 26 additions and 28 deletions

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */ /* Created: 2016/02/18 11:13:04 by alao #+# #+# */
/* Updated: 2017/03/14 12:09:55 by gwojda ### ########.fr */ /* Updated: 2017/03/15 13:47:27 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,7 +14,7 @@
# define COMPLETION_H # define COMPLETION_H
# include "minishell.h" # include "minishell.h"
#define RETARDED_BEHAVIOR 0 # define RETARDED_BEHAVIOR 0
/* /*
** Autocompletion list for the valid candidates from the parser. ** Autocompletion list for the valid candidates from the parser.
@ -178,5 +178,6 @@ int c_seek_env(t_comp *c, char *current_word);
void c_seek_abs_path(t_comp *c, char *current_word); void c_seek_abs_path(t_comp *c, char *current_word);
void c_arrow(t_comp *c, long int keypress); void c_arrow(t_comp *c, long int keypress);
int c_chevron(t_comp *c); int c_chevron(t_comp *c);
int c_dispatcher(t_data *s);
#endif #endif

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:31:21 by alao #+# #+# */ /* Created: 2017/01/09 13:31:21 by alao #+# #+# */
/* Updated: 2017/03/14 12:09:36 by gwojda ### ########.fr */ /* Updated: 2017/03/15 11:47:40 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -70,10 +70,6 @@ static char *c_slicer(t_comp *c)
i--; i--;
tmp[i] == '/' ? i++ : (0); tmp[i] == '/' ? i++ : (0);
rt = (i == (int)ft_strlen(tmp) - 1) ? NULL : ft_strsub(tmp, 0, i); rt = (i == (int)ft_strlen(tmp) - 1) ? NULL : ft_strsub(tmp, 0, i);
/* if (c_chevron(c))
c->match = ft_strdup("");
else
c->match = ft_strsub(tmp, i, ft_strlen(tmp) - i);*/
tmp ? ft_memdel((void *)&tmp) : (0); tmp ? ft_memdel((void *)&tmp) : (0);
return (rt); return (rt);
} }

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */
/* Updated: 2017/03/14 12:29:12 by gwojda ### ########.fr */ /* Updated: 2017/03/14 17:22:10 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/10 12:55:39 by alao #+# #+# */ /* Created: 2017/01/10 12:55:39 by alao #+# #+# */
/* Updated: 2017/03/10 16:09:46 by gwojda ### ########.fr */ /* Updated: 2017/03/15 14:30:37 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -126,7 +126,8 @@ void c_printer(t_comp *c)
//int offset; //int offset;
loop = c->c_line; loop = c->c_line;
if (!c->c_line)
return ;
max_line = c->c_line - (c->m_size - 1); max_line = c->c_line - (c->m_size - 1);
ptr = c_rolling(c); ptr = c_rolling(c);
if ((c->pos_y * (c->m_size - 1)) > c->c_line) if ((c->pos_y * (c->m_size - 1)) > c->c_line)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/09 15:50:24 by gwojda #+# #+# */ /* Created: 2017/03/09 15:50:24 by gwojda #+# #+# */
/* Updated: 2017/03/14 17:21:37 by gwojda ### ########.fr */ /* Updated: 2017/03/15 11:50:15 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,17 +28,16 @@ static int c_storing(t_comp *c, char *value)
int c_seek_env(t_comp *c, char *current_word) int c_seek_env(t_comp *c, char *current_word)
{ {
char *match;
char **env; char **env;
int i; int i;
i = 0; i = 0;
env = data_singleton()->env; env = data_singleton()->env;
match = ft_strdupi_w(current_word + 1); c->match = ft_strdupi_w(current_word + 1);
while (env[i]) while (env[i])
{ {
if (!ft_strncmp(match, env[i], ft_strlen(match)) && if (!ft_strncmp(c->match, env[i], ft_strlen(c->match)) &&
env[i][ft_strlen(match)] != '=') env[i][ft_strlen(c->match)] != '=')
c_storing(c, ft_strndup(env[i], ft_strchr(env[i], '=') - env[i])); c_storing(c, ft_strndup(env[i], ft_strchr(env[i], '=') - env[i]));
++i; ++i;
} }

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/10 08:50:26 by alao #+# #+# */ /* Created: 2017/01/10 08:50:26 by alao #+# #+# */
/* Updated: 2017/03/10 08:45:52 by alao ### ########.fr */ /* Updated: 2017/03/15 14:25:54 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -54,7 +54,7 @@ int c_sizing(t_comp *c)
c->lst && c->lst->name ? c_max_length(c) : 0; c->lst && c->lst->name ? c_max_length(c) : 0;
c->c_pline = c->win_x / (c->c_sx + 2); c->c_pline = c->win_x / (c->c_sx + 2);
c->c_line = 0; c->c_line = 0;
while ((c->c_line * c->c_pline) < c->c_sy) while (c->c_pline && (c->c_line * c->c_pline) < c->c_sy)
c->c_line++; c->c_line++;
if ((c->win_x < c->c_sx)) if ((c->win_x < c->c_sx))
{ {

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */ /* Created: 2016/10/11 10:44:40 by alao #+# #+# */
/* Updated: 2017/03/14 10:51:14 by gwojda ### ########.fr */ /* Updated: 2017/03/15 14:36:43 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -92,7 +92,7 @@ void c_term_mv_down(t_comp *c)
value = c->m_size - 1; value = c->m_size - 1;
else else
value = c->c_line - 1; value = c->c_line - 1;
while (i != value) while (value >= 0 && i != value)
{ {
ft_putstr(tgetstr("up", NULL)); ft_putstr(tgetstr("up", NULL));
i++; i++;

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */ /* Created: 2016/09/20 14:50:33 by alao #+# #+# */
/* Updated: 2017/03/14 11:22:04 by gwojda ### ########.fr */ /* Updated: 2017/03/15 14:37:34 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */ /* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
/* Updated: 2017/03/14 12:45:22 by gwojda ### ########.fr */ /* Updated: 2017/03/15 11:14:27 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,6 +22,7 @@ int put_job_in_foreground(t_job *j, int cont)
tcsetpgrp(STDIN, j->pgid); tcsetpgrp(STDIN, j->pgid);
if (cont) if (cont)
{ {
// j->tmodes = pas initialisé !
tcsetattr(STDIN, TCSADRAIN, &j->tmodes); tcsetattr(STDIN, TCSADRAIN, &j->tmodes);
if (kill(-j->pgid, SIGCONT) < 0) if (kill(-j->pgid, SIGCONT) < 0)
DG("kill(SIGCONT) failed"); DG("kill(SIGCONT) failed");

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */ /* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
/* Updated: 2017/03/14 16:00:05 by gwojda ### ########.fr */ /* Updated: 2017/03/15 13:55:22 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */ /* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
/* Updated: 2017/03/05 19:38:09 by gwojda ### ########.fr */ /* Updated: 2017/03/15 14:07:20 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -57,11 +57,13 @@ char *ft_read_stdin(void)
ft_is_str(); ft_is_str();
if (data_singleton()->comp) if (data_singleton()->comp)
c_clear(data_singleton()); c_clear(data_singleton());
signal(SIGWINCH, sigwinch_resize);
while (42) while (42)
{ {
ret = 0; ret = 0;
j = 0; j = 0;
read(0, &ret, sizeof(int)); read(0, &ret, sizeof(int));
DG("key hexa value = %X", ret);
if (ft_completion(ret)) if (ft_completion(ret))
continue ; continue ;
while (g_key[j].value && g_key[j].value != ret) while (g_key[j].value && g_key[j].value != ret)

View file

@ -6,12 +6,11 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/14 10:56:08 by gwojda #+# #+# */ /* Created: 2017/03/14 10:56:08 by gwojda #+# #+# */
/* Updated: 2017/03/14 12:00:29 by gwojda ### ########.fr */ /* Updated: 2017/03/15 14:25:51 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "minishell.h" #include "minishell.h"
int c_dispatcher(t_data *s);
void sigwinch_resize(int sig) void sigwinch_resize(int sig)
{ {

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
/* Updated: 2017/03/15 03:52:32 by wescande ### ########.fr */ /* Updated: 2017/03/15 13:46:36 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
/* Updated: 2017/03/14 23:25:40 by jhalford ### ########.fr */ /* Updated: 2017/03/15 13:55:49 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -35,7 +35,6 @@ static int interactive_settings(void)
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
signal(SIGCHLD, SIG_DFL); signal(SIGCHLD, SIG_DFL);
signal(SIGWINCH, sigwinch_resize);
*shell_pgid = getpid(); *shell_pgid = getpid();
if (setpgid(*shell_pgid, *shell_pgid)) if (setpgid(*shell_pgid, *shell_pgid))
{ {