{"pageup", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_PAGE}},
{"pagedown", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_PAGE}},
{"halfpageup", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_HALFPAGE}},
- {"halfpagedown", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_HALFPAGE}},
+ {"halfpagedown", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_HALFPAGE}},
{"scrollleft", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_LEFT | VB_SCROLL_UNIT_LINE}},
{"scrollright", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_RIGHT | VB_SCROLL_UNIT_LINE}},
{"scrollup", NULL, command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_LINE}},
}
/**
- * Runs a single command form string containing the command an possible
+ * Runs a single command form string containing the command and possible
* parameters.
*/
gboolean command_run_string(const char *input)
gboolean success;
char *command = NULL, *str, **token;
+ vb_set_mode(VB_MODE_NORMAL, false);
+
if (!input || *input == '\0') {
return false;
}
- str =g_strdup(input);
+ str = g_strdup(input);
/* remove leading whitespace */
g_strchug(str);
char **commands;
unsigned int len, i;
+ vb_set_mode(VB_MODE_NORMAL, false);
if (!arg->s || *(arg->s) == '\0') {
return false;
}
gboolean command_view_source(const Arg *arg)
{
+ vb_set_mode(VB_MODE_NORMAL, false);
+
gboolean mode = webkit_web_view_get_view_source_mode(vb.gui.webview);
webkit_web_view_set_view_source_mode(vb.gui.webview, !mode);
webkit_web_view_reload(vb.gui.webview);
- vb_set_mode(VB_MODE_NORMAL, false);
-
return true;
}
gboolean command_navigate(const Arg *arg)
{
+ vb_set_mode(VB_MODE_NORMAL, false);
+
WebKitWebView *view = vb.gui.webview;
if (arg->i <= VB_NAVIG_FORWARD) {
int count = vb.state.count ? vb.state.count : 1;
webkit_web_view_stop_loading(view);
}
- vb_set_mode(VB_MODE_NORMAL, false);
-
return true;
}
int direction = (arg->i & (1 << 2)) ? 1 : -1;
GtkAdjustment *adjust = (arg->i & VB_SCROLL_AXIS_H) ? vb.gui.adjust_h : vb.gui.adjust_v;
+ /* keep possible search mode */
+ vb_set_mode(VB_MODE_NORMAL | (vb.state.mode & VB_MODE_SEARCH), false);
+
max = gtk_adjustment_get_upper(adjust) - gtk_adjustment_get_page_size(adjust);
/* type scroll */
if (arg->i & VB_SCROLL_TYPE_SCROLL) {
}
gtk_adjustment_set_value(adjust, new > max ? max : new);
- /* keep possible search mode */
- vb_set_mode(VB_MODE_NORMAL | (vb.state.mode & VB_MODE_SEARCH), false);
-
return true;
}
gboolean success;
char *param = NULL, *line = NULL;
- if (!arg->s || !strlen(arg->s)) {
+ vb_set_mode(VB_MODE_NORMAL, false);
+ if (!arg->s || *(arg->s) == '\0') {
return false;
}
}
g_free(line);
- vb_set_mode(VB_MODE_NORMAL, false);
-
return success;
}
gboolean command_shortcut(const Arg *arg)
{
gboolean result;
+
+ vb_set_mode(VB_MODE_NORMAL, false);
+
if (arg->i) {
char *handle;
result = shortcut_remove(arg->s);
}
- vb_set_mode(VB_MODE_NORMAL, false);
-
return result;
}
float step, level;
int count;
+ vb_set_mode(VB_MODE_NORMAL, false);
+
if (arg->i & COMMAND_ZOOM_RESET) {
webkit_web_view_set_zoom_level(vb.gui.webview, 1.0);
- vb_set_mode(VB_MODE_NORMAL, false);
return true;
}
level + (float)(count *step) * (arg->i & COMMAND_ZOOM_IN ? 1.0 : -1.0)
);
- vb_set_mode(VB_MODE_NORMAL, false);
-
return true;
-
}
gboolean command_history(const Arg *arg)
gboolean command_bookmark(const Arg *arg)
{
- bookmark_add(webkit_web_view_get_uri(vb.gui.webview), arg->s);
vb_set_mode(VB_MODE_NORMAL, false);
+
+ bookmark_add(webkit_web_view_get_uri(vb.gui.webview), arg->s);
return true;
}
gboolean success;
char *value = NULL;
+ vb_set_mode(VB_MODE_NORMAL, false);
+
success = vb_eval_script(
webkit_web_view_get_main_frame(vb.gui.webview), arg->s, NULL, &value
);
vb_echo_force(VB_MSG_ERROR, true, "%s", value);
}
g_free(value);
- vb_set_mode(VB_MODE_NORMAL, false);
return success;
}