Open command with appended current filepath

Closes #30

Thanks to thorsten
This commit is contained in:
Moritz Lipp 2010-10-18 20:14:38 +02:00
parent a2771c1e23
commit 4ccfee59da
2 changed files with 11 additions and 2 deletions

View File

@ -104,6 +104,7 @@ Shortcut shortcuts[] = {
{GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, NORMAL, { .data = "?" } },
{0, GDK_colon, sc_focus_inputbar, NORMAL, { .data = ":" } },
{0, GDK_o, sc_focus_inputbar, NORMAL, { .data = ":open " } },
{0, GDK_O, sc_focus_inputbar, NORMAL, { APPEND_FILEPATH, .data = ":open " } },
{0, GDK_f, sc_follow, NORMAL, {0} },
{0, GDK_J, sc_navigate, NORMAL, { NEXT } },
{0, GDK_K, sc_navigate, NORMAL, { PREVIOUS } },

View File

@ -28,7 +28,7 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST,
ADD_MARKER, EVAL_MARKER, EXPAND, COLLAPSE, SELECT, GOTO_DEFAULT, GOTO_LABELS,
GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN, NEXT_CHAR, PREVIOUS_CHAR,
DELETE_TO_LINE_START };
DELETE_TO_LINE_START, APPEND_FILEPATH };
/* define modes */
#define ALL (1 << 0)
@ -1989,7 +1989,15 @@ sc_focus_inputbar(Argument* argument)
if(argument->data)
{
notify(DEFAULT, argument->data);
char* data = argument->data;
if(argument->n == APPEND_FILEPATH)
data = g_strdup_printf("%s%s", data, Zathura.PDF.file);
else
data = g_strdup(data);
notify(DEFAULT, data);
g_free(data);
gtk_widget_grab_focus(GTK_WIDGET(Zathura.UI.inputbar));
gtk_editable_set_position(GTK_EDITABLE(Zathura.UI.inputbar), -1);
}