vi-style scrolling
authorThomas Menari <spaceinvader@chaotika.org>
Sun, 7 Jun 2009 18:49:36 +0000 (20:49 +0200)
committerSimon Rozet <simon@rozet.name>
Sun, 7 Jun 2009 19:27:08 +0000 (21:27 +0200)
surf.c

diff --git a/surf.c b/surf.c
index 318d694..989cc51 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -183,7 +183,7 @@ keypress(GtkWidget* w, GdkEventKey *ev, gpointer d) {
                        return FALSE;
                }
        }
-       if(ev->state == GDK_CONTROL_MASK || ev->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
+        else if(ev->state == GDK_CONTROL_MASK || ev->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
                switch(ev->keyval) {
                case GDK_r:
                case GDK_R:
@@ -208,6 +208,16 @@ keypress(GtkWidget* w, GdkEventKey *ev, gpointer d) {
                        return TRUE;
                }
        }
+        else {
+                switch(ev->keyval) {
+                case GDK_k:
+                        webkit_web_view_move_cursor(c->view, GTK_MOVEMENT_DISPLAY_LINES, -1);
+                        return TRUE;
+                case GDK_j:
+                        webkit_web_view_move_cursor(c->view, GTK_MOVEMENT_DISPLAY_LINES, 1);
+                        return TRUE;
+                }
+        }
        return FALSE;
 }