}
/* 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) {
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;
}
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;
#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 {
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 {