static void ft_affelem(t_control *lst, char **mod, t_cursor c, t_cursor wh) { int j; int col; int size; char *str; t_args *tmp; str = ft_strnewset(lst->width, ' '); j = 0; col = 0; size = lst->size; tmp = lst->first; while (size--) { ft_putshell(mod[LISTC]); if (!j) ft_calccurx(&c, &col, lst, wh); tputs(tgoto(mod[CM], 0, c.y + j + 1), 1, ft_outc); if (col == 1) ft_putshell(str); ft_move_cursor(tmp, c.x, c.y + j + 1, mod); j = (j + 1 < (int)wh.y ? j + 1 : 0); ft_put_elem(lst, mod, tmp); tmp = tmp->next; } }
int ft_move(t_param *p, t_list *list, t_termios *term) { if (p->buffer[0] == 27 && p->buffer[1] == 0) { ft_clear_area(); ft_exit(p, list, term); } if (p->buffer[0] == 27 && p->buffer[1] == '[' && p->buffer[2] == 'A' || p->buffer[2] == 'B') { ft_move_cursor(p->pos.y); if (!p->value) ft_init_value(p, list); if (p->buffer[2] == 'A') ft_init_down(p, list); else if (p->buffer[2] == 'B') ft_init_up(p, list); ft_line(ft_ret_elt(list, p->pos.y)->data, p->pos.y, ft_ret_elt(list, p->pos.y)->valid, 1); ft_refresh_buff(p); } return (0); }