void ft_go_up(t_group *grp) { int i; i = -1; while (++i < TERM(window->width) && TERM(curs_pos) > 0) ft_left_arrow(grp); }
void ft_go_home(t_term *term) { int i; i = term->cursorpos; if (i > 0) while (i-- > 0) ft_left_arrow(term); }
void ft_clean_line(t_term *term) { ft_go_end(term); if (term->cmdlength == 0) return ; while (term->cmdlength-- > 0) { ft_left_arrow(term); tputs(tgetstr("dc", NULL), 0, ft_outchar); tputs(tgetstr("cd", NULL), 0, ft_outchar); } term->cmdlength = 0; if (term->cmdactual) ft_strdel(&(term->cmdactual)); }
void ft_backspace(t_term *term) { char *tmp; tmp = ft_strdup(&term->cmdactual[term->cursorpos]); ft_left_arrow(term); term->cmdlength--; term->cmdactual[term->cursorpos] = '\0'; term->cmdactual = ft_strjoin_nf(term->cmdactual, tmp, 3); tputs(tgetstr("dc", NULL), 0, ft_outchar); tputs(tgetstr("cd", NULL), 0, ft_outchar); tputs(tgetstr("sc", NULL), 0, ft_outchar); ft_putstr(&term->cmdactual[term->cursorpos]); tputs(tgetstr("rc", NULL), 0, ft_outchar); }
void ft_go_home(t_group *grp) { while (TERM(curs_pos) > 0) ft_left_arrow(grp); }