Esempio n. 1
0
void		ft_autocomp_print_line(t_list *list, size_t elem, t_stream *stream)
{
	size_t	new_elem;
	size_t	j;

	ft_print_elem(list, stream);
	if ((new_elem = elem + COMP_IN_COL) < COMP_SIZE_LIST)
	{
		stream->tput = "nd";
		ft_tputs(stream);
		ft_tputs(stream);
		j = COMP_IN_COL;
		while (j--)
			list = list->next;
		ft_autocomp_print_line(list, new_elem, stream);
	}
}
Esempio n. 2
0
void	handle_reg(t_group *grp, char *cap_code, int c)
{
	t_elem	*curr;

	curr = reset_underline(grp, c);
	ft_tputs(cap_code);
	set_underline(grp, curr);
}
Esempio n. 3
0
void		ft_up_down(t_edit **lst, t_hist **hst, char *key, struct winsize ws)
{
    t_hist		*tmp;

    tmp = NULL;
    if (*hst)
    {
        tmp = *hst;
        if (ARROW && key[2] == 65 && key[3] == 0)
            arrow_up(&tmp, lst);
        else
            arrow_down(&tmp, lst);
        ft_tputs("rc");
        ft_tputs("cd");
        ft_print_lste(lst);
    }
    if (((ft_poscurseur(lst) + 4) % ws.ws_col) == 0)
        ft_tputs("do");
}
Esempio n. 4
0
int		reset_shell(void)
{
	t_group	*grp;

	grp = init_grp();
	ft_tputs("ve");
	if (tcsetattr(0, 0, &(grp->cpy_term)) == -1)
		return (-1);
	return (0);
}
Esempio n. 5
0
static void		video_underl(t_lst *tmp)
{
	t_struct	*stt;
	int			fd;

	fd = 0;
	stt = NULL;
	stt = ft_struct();
	if (tmp->select == 1)
		ft_tputs("us");
	if (tmp->valid == 1)
		ft_tputs("mr");
	if ((fd = access(tmp->strr, F_OK)) != -1)
		ft_putstr_fd("\033[36;40m", stt->fd);
	ft_putstr_fd(tmp->strr, stt->fd);
	ft_tputs("ue");
	ft_tputs("me");
	if (fd == 0)
		ft_putstr_fd("\033[0m", stt->fd);
}
Esempio n. 6
0
void	clear_pos(t_elem *curr, int curs_on, char *color)
{
	size_t i;

	i = -1;
	tputs(tgoto(tgetstr("cm", NULL), curr->padding, curr->line), 1, ft_getchar);
	while (++i < ft_strlen(curr->name))
		ft_tputs("in");
	if (curr->selected)
	{
		ft_tputs("mr");
		ft_putstr_fd("\033[1;32m", 2);
		if (!curr->curs_on)
			ft_putstr_fd("\033[1;37m", 2);
		
	}
	else
		ft_putstr_fd(color, 2);
	curr->curs_on = curs_on;
}
Esempio n. 7
0
int			ft_move_prev(t_datas *datas, t_line *line, char *str)
{
	int			i;

	if (ft_strcmp(str, FTSH_KEY_SHLEFT) != 0)
		return (-1);
	if (line->x == 0 && line->y == 0)
	{
		ft_tputs("bl");
		return (1);
	}
	i = ft_move_prev_find(line);
	if (i == -2)
	{
		ft_tputs("bl");
		return (1);
	}
	while (line->i != i)
		ft_move_left(datas, line, FTSH_KEY_LEFT);
	return (0);
}
Esempio n. 8
0
void		ft_print_list(t_list *l, t_list *p)
{
	int		i;

	i = (p ? 0 : 1);
	ft_tputs("cl");
	while (l)
	{
		if (i || l == p)
			ft_tputs("us");
		ft_putstr_data(l);
		if (i || l == p)
		{
			i = 0;
			ft_tputs("ue");
			ft_tputs("sc");
		}
		ft_putchar('\n');
		l = l->next;
	}
	ft_tputs("rc");
}
Esempio n. 9
0
static int	ft_initialize_print(int *win, int fd)
{
	int			j;
	static int	k;

	ft_tputs("cd", 1, 0, fd);
	if (win[2] < win[0] || win[5] < win[4])
	{
		ft_tputs("cl", 1, 0, fd);
		k = 1;
		return (-1);
	}
	j = 0;
	while (j < win[4] - 1)
	{
		ft_tputs("sf", 1, 0, fd);
		j++;
	}
	if (k == 1)
		ft_tputs("cl", 1, 0, fd);
	ft_reset_cursor(win, win[4] - 1, fd);
	return (0);
}
Esempio n. 10
0
void		ft_autocomp_print_grid(size_t start, size_t end, t_stream *stream)
{
	size_t	j;
	t_list	*list;

	list = COMP_BEGIN_LIST;
	j = -1;
	while (++j < start)
		list = list->next;
	while (start < end)
	{
		ft_autocomp_print_line(list, start, stream);
		stream->tput = "le";
		j = COMP_COL;
		while (j--)
			ft_tputs(stream);
		stream->tput = "do";
		if (start != end - 1)
			ft_tputs(stream);
		list = list->next;
		start++;
	}
}
Esempio n. 11
0
int		ft_move_down(t_datas *datas, t_line *line, char *str)
{
	int		i;

	if (ft_strcmp(str, FTSH_KEY_SHDOWN) != 0)
		return (-1);
	if (line->i + datas->cols > line->len - 1)
	{
		ft_tputs("bl");
		return (1);
	}
	i = 0;
	while (i++ != datas->cols)
		ft_move_right(datas, line, FTSH_KEY_RIGHT);
	return (0);
}
Esempio n. 12
0
int		set_shell(int lflag)
{
	struct termios	term;
	t_group			*grp;

	grp = init_grp();
	if (tcgetattr(0, &term) == -1)
		return (-1);
	grp->cpy_term = term;
	term.c_lflag = term.c_lflag & lflag;
	term.c_cc[VMIN] = 1;
	term.c_cc[VTIME] = 0;
	if (tcsetattr(0, TCSADRAIN, &term))
		return (-1);
	ft_tputs("vi");
	return (0);
}
Esempio n. 13
0
void		ft_jumprint(t_edit **lst)
{
	int				jump;
	int				i;
	struct winsize	ws;

	get_winsize(&ws);
	i = 0;
	jump = ((l_list(lst) + 3) / ws.ws_col) - ((ft_pcur(lst) + 3) / ws.ws_col);
	if (!((l_list(lst) + 3) % ws.ws_col) == 0)
	{
		while (i < jump)
		{
			ft_tputs("do");
			i++;
		}
	}
}
Esempio n. 14
0
static void	ft_prompt_readkey_handler(t_datas *datas, char *key)
{
	int				i;
	static t_fkey	*fkey[14] =

	{
	&ft_move_home, &ft_move_end, &ft_history_next, &ft_history_prev,
	&ft_move_left, &ft_move_right, &ft_move_next, &ft_move_prev,
	&ft_move_up, &ft_move_down, &ft_prompt_ctrld,
	&ft_prompt_autocomplete, &ft_prompt_ctrlr, NULL
	};
	if (ft_strlen(key) == 0)
	{
		ft_tputs("bl");
		return ;
	}
	i = 0;
	while (fkey[i] != NULL && (fkey[i])(datas, datas->prompt.line, key) == -1)
		i++;
}