/* Callback that is invoked when menu item is selected. Should return non-zero * to stay in menu mode. */ static int execute_history_cb(FileView *view, menu_info *m) { const char *const line = m->items[m->pos]; switch((HistoryType)m->extra_data) { case CMDHISTORY: cfg_save_command_history(line); exec_commands(line, view, CIT_COMMAND); break; case FSEARCHHISTORY: cfg_save_search_history(line); exec_commands(line, view, CIT_FSEARCH_PATTERN); break; case BSEARCHHISTORY: cfg_save_search_history(line); exec_commands(line, view, CIT_BSEARCH_PATTERN); break; case FILTERHISTORY: cfg_save_filter_history(line); exec_commands(line, view, CIT_FILTER_PATTERN); break; case PROMPTHISTORY: /* Can't replay prompt input. */ break; } return 0; }
static void save_to_history(const char str[]) { cfg_save_command_history(str); cfg_save_search_history(str); cfg_save_prompt_history(str); save_view_history(&lwin, str, str + 1, 0); save_view_history(&rwin, str, str + 1, 0); }
/* Saves the command to the appropriate history. */ static void save_extcmd(const char command[], CmdInputType type) { if(type == CIT_COMMAND) { cfg_save_command_history(command); } else { cfg_save_search_history(command); } }