Added cmd_search

This commit is contained in:
Moritz Lipp 2011-10-22 16:35:38 +02:00
parent 37189ece79
commit 98cc73d3e4
3 changed files with 28 additions and 0 deletions

View file

@ -265,3 +265,19 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list)
return true;
}
bool
cmd_search(girara_session_t* session, char* input, girara_argument_t* argument)
{
g_return_val_if_fail(session != NULL, false);
g_return_val_if_fail(input != NULL, false);
g_return_val_if_fail(argument != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
if (zathura->document == NULL) {
return false;
}
return true;
}

View file

@ -96,5 +96,14 @@ bool cmd_save(girara_session_t* session, girara_list_t* argument_list);
*/
bool cmd_savef(girara_session_t* session, girara_list_t* argument_list);
/**
* Search the current file
*
* @param session The used girara session
* @param input The current input
* @param argument Passed argument
* @return true if no error occured
*/
bool cmd_search(girara_session_t* session, char* input, girara_argument_t* argument);
#endif // COMMANDS_H

View file

@ -122,6 +122,9 @@ config_load_default(zathura_t* zathura)
girara_inputbar_command_add(gsession, "write", NULL, cmd_save, NULL, "Save document");
girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, NULL, "Save document (and force overwriting)");
girara_special_command_add(gsession, '/', cmd_search, true, FORWARD, NULL);
girara_special_command_add(gsession, '?', cmd_search, true, BACKWARD, NULL);
/* add shortcut mappings */
girara_shortcut_mapping_add(gsession, "abort", sc_abort);
girara_shortcut_mapping_add(gsession, "adjust_window", sc_adjust_window);