From b4b65a2233db01ed75acac90acb51d320ad8a73d Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 1 Jun 2013 20:32:39 +0200 Subject: [PATCH] Minor code improvements. --- config.mk | 1 - src/keybind.c | 2 +- src/main.c | 9 +++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config.mk b/config.mk index 62024a6..1df24b4 100644 --- a/config.mk +++ b/config.mk @@ -46,7 +46,6 @@ ifeq ($(USEGTK3), 1) CPPFLAGS += -DHAS_GTK3 endif - #----------------developer options------------------- DFLAGS += $(CFLAGS) DFLAGS += -DDEBUG diff --git a/src/keybind.c b/src/keybind.c index 98427b6..3d25bd8 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -251,7 +251,7 @@ static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event) return true; } /* allow mode keys and counts only in normal mode and search mode */ - if (vb.state.mode == VB_MODE_NORMAL || vb.state.mode & VB_MODE_SEARCH) { + if (vb.state.mode & (VB_MODE_NORMAL|VB_MODE_SEARCH)) { if (vb.state.modkey == 0 && ((keyval >= GDK_1 && keyval <= GDK_9) || (keyval == GDK_0 && vb.state.count))) { /* append the new entered count to previous one */ diff --git a/src/main.c b/src/main.c index e68e055..84931b5 100644 --- a/src/main.c +++ b/src/main.c @@ -206,12 +206,9 @@ gboolean vb_set_clipboard(const Arg *arg) */ gboolean vb_set_mode(Mode mode, gboolean clean) { - int clean_old = CLEAN_MODE(vb.state.mode); - int clean_new = CLEAN_MODE(mode); - vb.state.modkey = vb.state.count = 0; - /* prcess only if mode has changed */ + /* process only if mode has changed */ if (vb.state.mode != mode) { /* leaf the old mode */ if ((vb.state.mode & VB_MODE_COMPLETE) && !(mode & VB_MODE_COMPLETE)) { @@ -220,13 +217,13 @@ gboolean vb_set_mode(Mode mode, gboolean clean) command_search(&((Arg){VB_SEARCH_OFF})); } else if ((vb.state.mode & VB_MODE_HINTING) && !(mode & VB_MODE_HINTING)) { hints_clear(); - } else if (clean_old == VB_MODE_INSERT) { + } else if (CLEAN_MODE(vb.state.mode) == VB_MODE_INSERT) { clean = true; dom_clear_focus(vb.gui.webview); } /* enter the new mode */ - switch (clean_new) { + switch (CLEAN_MODE(mode)) { case VB_MODE_NORMAL: history_rewind(); gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview)); -- 2.20.1