summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2012-11-12 19:08:53 +0100
committerDaniel Carl <danielcarl@gmx.de>2012-11-12 19:08:53 +0100
commit30be6b0b2a9bf61d2e20ccaad3280bdde386432b (patch)
treee33b24ee02fca809649e9de0684703de8c8ce28c
parent31f6ea0eb61ad76ea4b78e3f3c3d4d7436d24a45 (diff)
Added macro to get only main modes.
-rw-r--r--src/keybind.c6
-rw-r--r--src/main.c5
-rw-r--r--src/main.h5
3 files changed, 9 insertions, 7 deletions
diff --git a/src/keybind.c b/src/keybind.c
index 6ba3a5b..1dff1c5 100644
--- a/src/keybind.c
+++ b/src/keybind.c
@@ -208,13 +208,15 @@ static gboolean keybind_keypress_callback(WebKitWebView* webview, GdkEventKey* e
}
/* TODO should we use a command for that too? */
- if (event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab) {
+ if (CLEAN_MODE(vp.state.mode) == VP_MODE_COMMAND
+ && (event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab)
+ ) {
completion_complete(event->keyval == GDK_ISO_Left_Tab);
return TRUE;
}
/* check for keybinding */
- GSList* link = keybind_find(vp.state.mode, vp.state.modkey,
+ GSList* link = keybind_find(CLEAN_MODE(vp.state.mode), vp.state.modkey,
(CLEAN(event->state) & ~irrelevant), keyval);
if (link) {
diff --git a/src/main.c b/src/main.c
index 87eee77..49407cd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -268,8 +268,7 @@ void vp_clean_up(void)
static gboolean vp_hide_message(void)
{
/* do not clean in command mode */
- /* TODO add a CLEAN_MODE macro to get only the main modes */
- if (vp.state.mode & VP_MODE_COMMAND) {
+ if (CLEAN_MODE(vp.state.mode) == VP_MODE_COMMAND) {
return FALSE;
}
@@ -294,7 +293,7 @@ gboolean vp_set_mode(const Arg* arg)
vp.state.mode = arg->i;
vp.state.modkey = vp.state.count = 0;
- switch (arg->i) {
+ switch (CLEAN_MODE(arg->i)) {
case VP_MODE_NORMAL:
gtk_widget_grab_focus(GTK_WIDGET(vp.gui.webview));
break;
diff --git a/src/main.h b/src/main.h
index 5d84953..a0592c0 100644
--- a/src/main.h
+++ b/src/main.h
@@ -44,6 +44,7 @@
#endif
#define GET_TEXT() (gtk_entry_get_text(GTK_ENTRY(vp.gui.inputbox)))
+#define CLEAN_MODE(mode) ((mode) & ~(VP_MODE_COMPLETE))
/* enums */
typedef enum _vp_mode {
@@ -51,8 +52,8 @@ typedef enum _vp_mode {
VP_MODE_COMMAND = 1<<1,
VP_MODE_PATH_THROUGH = 1<<2,
VP_MODE_INSERT = 1<<3,
- VP_MODE_COMPLETE = 1<<4,
- VP_MODE_SEARCH = 1<<5,
+ VP_MODE_SEARCH = 1<<4,
+ VP_MODE_COMPLETE = 1<<5,
} Mode;
enum {