int term_up(char **send, unsigned long int buff, t_comp *count, t_tab *stock) { char *cp; char *s1; (void)buff; if (!stock->list) return (0); cp = tgetstr("dl", NULL); s1 = tgoto(cp, 0, 0); if (my_tputs(s1, 0, my_putchar) == -1) return (-1); cp = tgetstr("ch", NULL); s1 = tgoto(cp, 0, 0); if (my_tputs(s1, 0, my_putchar) == -1) return (-1); prompt(stock); if (stock && stock->move && stock->list->next) stock->list = stock->list->next; free(*send); my_putstr(stock->list->data); *send = my_strdup(stock->list->data); count->save = my_strlen(stock->list->data); count->compt = count->save; stock->move = 1; return (0); }
int eol(t_elem *e) { my_tputs(e->cap[VI]); while (move_right(e) != -1); my_tputs(e->cap[VE]); return (0); }
int destroy(struct termios *t) { if (tcsetattr(0, 0, t) == -1) { fprintf(stderr, TERMCAP_ERR); return (-1); } my_tputs(tgetstr("is", NULL)); my_tputs(tgetstr("rs", NULL)); return (0); }
void clearscreen(t_list *root) { int i; i = 0; while (i < root->nb_elem) { my_tputs(tgetstr("up", NULL)); i = i + 1; } i = 0; while (i < root->nb_elem) { my_tputs(tgetstr("dl", NULL)); i = i + 1; } }
int ctrl_y(t_elem *e) { t_string *cpy; t_string *save; if (taille_clip(e) < 1) return (0); save = e->cursor; cpy = e->clipboard; my_tputs(e->cap[VI]); _bol(e, 0); while (e->cursor != save) e->cursor = e->cursor->next; past(e, cpy, save); my_tputs(e->cap[VE]); return (0); }
int init_termcaps(struct termios *t) { if (tcgetattr(0, t) == -1) return (-1); if (raw_mode(t) == -1) return (-1); if (d_echo(t) == -1) return (-1); my_tputs(tgetstr("im", NULL)); return (0); }
int past(t_elem *e, t_string *cpy, t_string *save) { if (e->clipboard) { while (cpy) { my_tputs(e->cap[VI]); push_char(e, cpy->c, 0); cpy = cpy->next; } e->cursor = e->s; my_tputs(e->cap[VI]); while (move_right_write(e) != -1); my_tputs(e->cap[VI]); _bol(e, 0); my_tputs(e->cap[VI]); while (e->cursor != save) move_right(e); } return (0); }
int ctrl_k(t_elem *e) { free_string_edit(e->clipboard); e->clipboard = NULL; string_dup(e); my_tputs(e->cap[CD]); if (e->cursor->next) free_end_of_clip(e->cursor->next); e->cursor->c = 0; e->cursor->next = NULL; e->len -= taille_clip(e); return (0); }
int term_right(char **send, unsigned long int buff, t_comp *count, t_tab *stock) { char *cp; char *s1; (void)buff; (void)stock; (void)send; if (count->compt != count->save) { count->compt++; cp = tgetstr("RI", NULL); s1 = tgoto(cp, 1, 0); if (my_tputs(s1, 0, my_putchar) == -1) return (-1); } return (0); }
void rm_line(t_elem *e) { bol(e); my_tputs(e->cap[CD]); }