mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-29 08:24:55 +01:00
Added cmd_search
This commit is contained in:
parent
37189ece79
commit
98cc73d3e4
3 changed files with 28 additions and 0 deletions
16
commands.c
16
commands.c
|
@ -265,3 +265,19 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list)
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
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
|
#endif // COMMANDS_H
|
||||||
|
|
3
config.c
3
config.c
|
@ -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_save, NULL, "Save document");
|
||||||
girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, NULL, "Save document (and force overwriting)");
|
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 */
|
/* add shortcut mappings */
|
||||||
girara_shortcut_mapping_add(gsession, "abort", sc_abort);
|
girara_shortcut_mapping_add(gsession, "abort", sc_abort);
|
||||||
girara_shortcut_mapping_add(gsession, "adjust_window", sc_adjust_window);
|
girara_shortcut_mapping_add(gsession, "adjust_window", sc_adjust_window);
|
||||||
|
|
Loading…
Reference in a new issue