t_elem *ft_get_input(char *s, t_elem *l, int *flag) { if (*flag == 1) *flag = 0; else if (s[0] == 27 && s[2] == 'A') ft_up(l); else if (s[0] == 27 && s[2] == 'B') ft_down(l); else if (s[0] == 32) ft_space(l); else if (s[0] == 1) ft_select_all(l); else if (s[0] == 24) ft_unselect_all(l); else if (s[0] == 27 && s[2] == 'F') ft_go_toend(l); else if (s[0] == 27 && s[2] == 'H') ft_go_home(l); else if ((s[0] == 27 && s[1] == 0) || s[0] == 4) ft_unset_canon(); else if (s[0] == '\n') ft_enter(l); else if (s[0] == 8 || s[0] == 127 || (s[0] == 27 && s[2] == '3')) l = ft_delete(l); return (l); }
void ft_while_main(int tab[4][4]) { int c; while ((c = getch())) { if (c == 27) break ; if (c == KEY_RIGHT) ft_down(tab); if (c == KEY_LEFT) ft_up(tab); if (c == KEY_UP) ft_left(tab); if (c == KEY_DOWN) ft_right(tab); if (!can_move(tab)) { refresh(); clear(); printw("Can't move mother f****r"); getch(); } ft_aff_square(tab); if (!ft_aff_square(tab)) printw("Window too small.\nThat's what she said."); } }
void ft_all(sel_list lalist, int argc, char *pos) { char read_char[5] = {0}; co_list coord; coord.x = 0; coord.y = 0; while (!(*(unsigned int *)read_char == 27)) { tputs(tgetstr("vi", NULL), 1, ft_putc); if (*(unsigned int *)read_char == 32) ft_space(&lalist, &coord, pos); if (*(unsigned int *)read_char == 4348699) ft_down(&lalist, argc, &coord, pos); if (*(unsigned int *)read_char == 4283163) ft_up(&lalist, argc, &coord, pos); if (*(unsigned int *)read_char == 10) { ft_aff(&lalist); exit(0); } ft_bzero(read_char, 5); read(0, read_char, 4); } tputs(tgetstr("te", NULL), 1, ft_putc); }
char *ft_print_integers(char *convchars, va_list ap) { intmax_t arg; char *regex_printed; int base; base = 10; if (ft_wrong_specifier(convchars[0])) return (ft_memset(ft_strnew(1), convchars[0], 1)); if (convchars[0] == 'o') base = 8; else if (convchars[0] == 'x' || convchars[0] == 'X') base = 16; if (convchars[0] == '%') return (ft_memset(ft_strnew(1), '%', 1)); arg = va_arg(ap, intmax_t); regex_printed = NULL; regex_printed = ft_particular(arg, convchars, regex_printed); regex_printed = ft_signed_int(arg, convchars, regex_printed); regex_printed = ft_unsigned_int(arg, convchars, base, regex_printed); if (convchars[0] == 'c' && !convchars[1]) regex_printed = ft_memset(ft_strnew(1), (int)arg, 1); else if (convchars[0] == 'c' && convchars[1] == 'l') regex_printed = ft_wchar_display(arg); if (convchars[0] == 'X') ft_up(regex_printed); return (regex_printed); }
void ft_command(t_list **l, char buf[4], struct termios *term) { int ret; t_list *cursor; cursor = (*l)->next; while (!check_break(buf, cursor)) { buf[0] = 0; buf[1] = 0; buf[2] = 0; tputs(tgetstr("cl", NULL), 1, tty_putchar); ft_underline(cursor, l); ret = read(0, buf, 3); buf[ret] = '\0'; ft_space(&cursor, buf); ft_up(&cursor, buf); ft_down(&cursor, buf); ft_check_esc(buf, term); ft_delete(cursor, buf, &cursor); } }