From 5130922e2024218321c8b49386e20615a8767002 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Thu, 30 Apr 2009 23:58:56 +0200 Subject: Entering insert mode is now function --- uzbl.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index ec16590..f3c6588 100644 --- a/uzbl.c +++ b/uzbl.c @@ -131,6 +131,9 @@ free_action(gpointer action); static Action* new_action(const gchar *name, const gchar *param); +static void +set_insert_mode(WebKitWebView *page, const gchar *param); + /* --- CALLBACKS --- */ @@ -278,6 +281,7 @@ static struct {char *name; Command command;} cmdlist[] = { "toggle_status", toggle_status_cb }, { "spawn", spawn }, { "exit", close_uzbl }, + { "insert_mode", set_insert_mode } }; static void @@ -324,6 +328,15 @@ file_exists (const char * filename) { return false; } +void +set_insert_mode(WebKitWebView *page, const gchar *param) { + (void)page; + (void)param; + + insert_mode = TRUE; + update_title (GTK_WINDOW (main_window)); +} + static void load_uri (WebKitWebView * web_view, const gchar *param) { if (param) { @@ -566,8 +579,8 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) || event->keyval == GDK_Up || event->keyval == GDK_Down || event->keyval == GDK_Left || event->keyval == GDK_Right) return FALSE; - //TURN OFF/ON INSERT MODE - if ((insert_mode && (event->keyval == GDK_Escape)) || (!insert_mode && (event->string[0] == 'i') && !keycmd->len)) { + /* turn of insert mode */ + if (insert_mode && (event->keyval == GDK_Escape)) { insert_mode = !insert_mode || always_insert_mode; update_title (GTK_WINDOW (main_window)); return TRUE; -- cgit v1.2.3