Behaviour when buffer is not empty

This commit does not allow every shortcut
when the buffer is not empty
This commit is contained in:
Moritz Lipp 2010-06-19 16:38:57 +02:00
parent 5db3407822
commit 3604922a95

View file

@ -3880,13 +3880,17 @@ cb_view_kb_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
{ {
if( event->keyval == sc->element.key && if( event->keyval == sc->element.key &&
((CLEAN(event->state) == sc->element.mask) || ((CLEAN(event->state) == sc->element.mask) ||
((sc->element.mask == 0) && (sc->element.key >= 20 && sc->element.key <= 126))) && ((sc->element.mask == 0) && (sc->element.key >= 0x21 && sc->element.key <= 0x7E))) &&
(Zathura.Global.mode & sc->element.mode || sc->element.mode == ALL) && (Zathura.Global.mode & sc->element.mode || sc->element.mode == ALL) &&
sc->element.function sc->element.function
) )
{ {
sc->element.function(&(sc->element.argument)); if(!(Zathura.Global.buffer && strlen(Zathura.Global.buffer->str)) ^
return TRUE; ((sc->element.mask == GDK_CONTROL_MASK) || (sc->element.mask == GDK_MOD1_MASK)))
{
sc->element.function(&(sc->element.argument));
return TRUE;
}
} }
sc = sc->next; sc = sc->next;
@ -3906,7 +3910,7 @@ cb_view_kb_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
} }
/* append only numbers and characters to buffer */ /* append only numbers and characters to buffer */
if( (event->keyval >= 0x21) && (event->keyval <= 0x7A)) if( (event->keyval >= 0x21) && (event->keyval <= 0x7E))
{ {
if(!Zathura.Global.buffer) if(!Zathura.Global.buffer)
Zathura.Global.buffer = g_string_new(""); Zathura.Global.buffer = g_string_new("");