void prompt_shell(t_shell *sh, t_prompt *prompt, char *buff) { if (prompt->i < 4500) { deal_with_charac(prompt, buff); deal_with_space(prompt, buff); } go_down_line(prompt, buff); go_up_line(prompt, buff); deal_with_backspace(prompt, buff); deal_with_delete(prompt, buff); deal_with_left(prompt, buff); deal_with_right(prompt, buff); deal_with_up(sh, prompt, buff); deal_with_down(sh, prompt, buff); go_to_start_of_line(prompt, buff); go_to_previous_word(prompt, buff); go_to_next_word(prompt, buff); go_to_end(prompt, buff); start_copy_mode(prompt, buff); copy_string(prompt, buff); cut_string(prompt, buff); paste_string(prompt, buff); start_auto_complete(prompt, buff); input_clear(sh, prompt, buff); }
void print_history(t_it *it) { t_history *history; static t_history *list = NULL; history = ft_stock_history(NULL); if (!history) return ; if (!it->line) { ft_memdel((void**)&it->tmp_line); it->tmp_line = NULL; } if (!list || it->buffer == RET) { list = go_to_end(history); if (it->buffer == RET) list = list->next; it->first = 1; ft_stock_history(list); } if (it->buffer == KU) list = up_history(list, it); if (it->buffer == KD) list = down_history(list, it); }
static void is_special_action(char *key) { if (key[0] == 27 && key[1] == 91 && key[2] == 72) go_to_start(); else if (key[0] == 27 && key[1] == 91 && key[2] == 70) go_to_end(); else if (key[0] == 21 && key[1] == 0 && key[2] == 0) cut_entire_line(); else if (key[0] == 11 && key[1] == 0 && key[2] == 0) cut_end_of_line(); else if (key[0] == 16 && key[2] == 0 && key[2] == 0) paste(); else if (key[0] == 12 && key[1] == 0 && key[2] == 0) clear(); else if (key[0] == 3 && key[1] == 0 && key[2] == 0) handle_ctrl_c(); else if (key[0] == 2 && key[1] == 0 && key[2] == 0) move_back_word(); else if (key[0] == 14 && key[1] == 0 && key[2] == 0) move_next_word(); else if (key[0] == 27 && key[1] == 91 && key[2] == 53) go_up(); else if (key[0] == 27 && key[1] == 91 && key[2] == 54) go_down(); }
void keyboard_ctrlc(t_readline *r) { go_to_end(r); ft_putchar('\n'); free(r->line); r->line = (char *)malloc(sizeof(char)); (r->line)[0] = '\0'; r->i = 0; ft_printf("{PYELLOW}%s{EOC}", r->prompt); }
void MainWindow::setup_shortcuts(){ static struct Pair{ const char *command; const char *slot; } pairs[] = { #define SETUP_SHORTCUT(command, slot) { command, SLOT(slot)}, SETUP_SHORTCUT(quit_command, quit_slot()) SETUP_SHORTCUT(quit2_command, quit2_slot()) SETUP_SHORTCUT(next_command, next_slot()) SETUP_SHORTCUT(back_command, back_slot()) SETUP_SHORTCUT(background_swap_command, background_swap_slot()) SETUP_SHORTCUT(close_command, close_slot()) SETUP_SHORTCUT(zoom_in_command, zoom_in_slot()) SETUP_SHORTCUT(zoom_out_command, zoom_out_slot()) SETUP_SHORTCUT(reset_zoom_command, reset_zoom_slot()) SETUP_SHORTCUT(up_command, up_slot()) SETUP_SHORTCUT(down_command, down_slot()) SETUP_SHORTCUT(left_command, left_slot()) SETUP_SHORTCUT(right_command, right_slot()) SETUP_SHORTCUT(up_big_command, up_big_slot()) SETUP_SHORTCUT(down_big_command, down_big_slot()) SETUP_SHORTCUT(left_big_command, left_big_slot()) SETUP_SHORTCUT(right_big_command, right_big_slot()) SETUP_SHORTCUT(cycle_zoom_mode_command, cycle_zoom_mode_slot()) SETUP_SHORTCUT(toggle_lock_zoom_command, toggle_lock_zoom_slot()) SETUP_SHORTCUT(go_to_start_command, go_to_start()) SETUP_SHORTCUT(go_to_end_command, go_to_end()) SETUP_SHORTCUT(toggle_fullscreen_command, toggle_fullscreen()) SETUP_SHORTCUT(rotate_left_command, rotate_left()) SETUP_SHORTCUT(rotate_right_command, rotate_right()) SETUP_SHORTCUT(rotate_left_fine_command, rotate_left_fine()) SETUP_SHORTCUT(rotate_right_fine_command, rotate_right_fine()) SETUP_SHORTCUT(flip_h_command, flip_h()) SETUP_SHORTCUT(flip_v_command, flip_v()) SETUP_SHORTCUT(minimize_command, minimize_slot()) SETUP_SHORTCUT(minimize_all_command, minimize_all_slot()) SETUP_SHORTCUT(show_options_command, show_options_dialog()) }; for (auto &c : this->connections) this->disconnect(c); this->connections.clear(); this->shortcuts.clear(); auto &shortcuts = this->app->get_shortcuts(); for (auto &p : pairs){ auto setting = shortcuts.get_shortcut_setting(p.command); if (!setting) continue; for (auto &seq : setting->sequences) this->setup_shortcut(seq, p.slot); } }