According to the vim editor, the number of mode of vimb browser are reduced.
The previous search mode and hinting mode aren't implemented as main modes
with own keybindings, they are now submodes of the normal and command mode
instead. This allow to use the already defined keybindings also for the search
and hinting mode. For example it's possible to navigate in search mode, that
was not possible before.
The searching is now more like in vim, where all the navigation commands work
in search mode too. Also if the searching is aborted by hitting <esc> the
search query keeps memorized and could be continued by command search-{forward,
backward}.
.B Insert Mode
Used for editing text elements in a webpage.
.TP
-.B Hint Mode
-Follow links, form fields and frames via hints.
-.TP
.B Command Mode
Execute PROJECT commands from the builtin inputbox (commandline).
-.TP
-.B Search Mode
-Search for strings within the current displayed page.
-.TP
-.B Insert Mode
-Used for editing text elements in a webpage.
.SH COMMANDS
Commands are a central part in PROJECT. They are used for nearly all things
that could be done with this browser. Commands allow to set config variables,
.BI [ N "]scrolldown"
Scroll the page \fIN\fP times the "scrollstep" to the end.
.SS Keybinding
-To bind a command to a key sequence use the {n,i,c,h}map command. To map a
+To bind a command to a key sequence use the {n,i,c}map command. To map a
keysequence to a command, use this format "nmap {[modkey]key}={command}[ params]".
The modkey is a single simple char like "g". The key can also contain
Example:
.br
-"hmap <shift\-tab>=hint\-focus\-prev" to add focus next in in Hinting Mode.
-.br
"nmap <shift\-?>=input :foo" to write :foo into input box and switch to Command Mode.
.br
"hunmap <shift\-tab>" To remove this keybinding use.
.B cmap
Add a keybinding used in Command Mode.
.TP
-.B hmap
-Add a keybinding used in Hint Mode.
-.TP
-.B smap
-Add keybinding used in Search Mode.
-.TP
.B nunmap
Remove a Normal Mode keybinding.
.TP
.B cunmap
Remove a Command Mode keybinding.
.TP
-.B hunmap
-Remove a Hint Mode keybinding.
-.TP
-.B sunmap
-Remove a Search Mode keybinding.
.SS Complete
.TP
.B complete
Start hinting to open inputboxes or textareas with external editor. If
\fIPREFIX\fP is given, print this into the inputbox, default ';e'.
.TP
-.B hint-focus-nex, hint-focus-prevt
+.B hint-focus-nex, hint-focus-prev
Focus next or previous hint.
.SS Yank
.TP
.TP
.B z\-z
Reset Zoom.
+.TP
+.BI [ N ]n
+Search for \fIN\fPnth next search result.
+.TP
+.BI [ N ]N
+Search for \fIN\fPnth previous search result.
+.TP
+.B <tab>
+Hint to the next element.
+.TP
+.B <shift-tab>
+Hint the previous element.
.SS COMMAND_MODE
.TP
.B tab
.B shift\-tab
Complete backward different sources in the inputbox.
.TP
-.B ctrl\-p, up
+.B up
Step through hinstory backward.
.TP
-.B ctrl\-n, down
+.B down
Step through hinstory forward.
.TP
-.B tab
+.B ctrl\-n
Foxus the next hint.
.TP
-.B shift\-tab
+.B ctrl\-p
Foxus the previous hint.
-.SS SEARCH_MODE
-.TP
-.BI [ N ]n
-Search for \fIN\fPnth next search result.
-.TP
-.BI [ N ]N
-Search for \fIN\fPnth previous search result.
.SS INSERT_MODE
.TP
.B ctrl-t
{"nmap", command_map, {VB_MODE_NORMAL}},
{"imap", command_map, {VB_MODE_INSERT}},
{"cmap", command_map, {VB_MODE_COMMAND}},
- {"hmap", command_map, {VB_MODE_HINTING}},
- {"smap", command_map, {VB_MODE_SEARCH}},
{"nunmap", command_unmap, {VB_MODE_NORMAL}},
{"iunmap", command_unmap, {VB_MODE_INSERT}},
{"cunmap", command_unmap, {VB_MODE_COMMAND}},
- {"hunmap", command_unmap, {VB_MODE_HINTING}},
- {"sunmap", command_map, {VB_MODE_SEARCH}},
{"set", command_set, {0}},
{"complete", command_complete, {0}},
{"complete-back", command_complete, {1}},
}
gtk_adjustment_set_value(adjust, new > max ? max : new);
- vb_set_mode(VB_MODE_NORMAL, false);
+ /* keep possible search mode */
+ vb_set_mode(VB_MODE_NORMAL | (vb.state.mode & VB_MODE_SEARCH), false);
return true;
}
{
gboolean forward = !(arg->i ^ vb.state.search_dir);
- if (arg->i == VB_SEARCH_OFF && vb.state.search_query) {
- OVERWRITE_STRING(vb.state.search_query, NULL);
+ if (arg->i == VB_SEARCH_OFF) {
#ifdef FEATURE_SEARCH_HIGHLIGHT
webkit_web_view_unmark_text_matches(vb.gui.webview);
#endif
-
return true;
}
} while (--vb.state.count);
}
- vb_set_mode(VB_MODE_SEARCH, false);
+ vb_set_mode(VB_MODE_NORMAL | VB_MODE_SEARCH, false);
return true;
}
"nmap <shift-:>=input",
"nmap <shift-/>=input /",
"nmap <shift-?>=input ?",
- "smap n=search-forward",
- "smap N=search-backward",
+ "nmap n=search-forward",
+ "nmap N=search-backward",
"nmap o=input :open ",
"nmap t=input :tabopen ",
"nmap O=inputuri :open ",
"nmap zz=zoomreset",
"cmap <tab>=complete",
"cmap <shift-tab>=complete-back",
- "cmap <ctrl-p>=hist-prev",
+ "cmap <ctrl-p>=hint-focus-prev",
+ "cmap <ctrl-n>=hint-focus-next",
"cmap <up>=hist-prev",
- "cmap <ctrl-n>=hist-next",
"cmap <down>=hist-next",
- "hmap <tab>=hint-focus-next",
- "hmap <shift-tab>=hint-focus-prev",
"imap <ctrl-t>=editor",
"searchengine-add dl=https://duckduckgo.com/lite/?q=%s",
"searchengine-add dd=https://duckduckgo.com/?q=%s",
char *js, *value = NULL;
observe_input(false);
- if (CLEAN_MODE(vb.state.mode) == VB_MODE_HINTING) {
+ if (vb.state.mode & VB_MODE_HINTING) {
js = g_strdup_printf("%s.clear();", HINT_VAR);
vb_eval_script(webkit_web_view_get_main_frame(vb.gui.webview), js, HINT_FILE, &value);
g_free(value);
void hints_create(const char *input, guint mode, const guint prefixLength)
{
char *js = NULL;
- if (CLEAN_MODE(vb.state.mode) != VB_MODE_HINTING) {
- vb_set_mode(VB_MODE_HINTING, false);
+ if (!(vb.state.mode & VB_MODE_HINTING)) {
+ vb_set_mode(VB_MODE_COMMAND | VB_MODE_HINTING, false);
Style *style = &vb.style;
hints.prefixLength = prefixLength;
return true;
}
- /* allow mode keys and counts only in normal mode */
- if ((VB_MODE_SEARCH | VB_MODE_NORMAL) & vb.state.mode) {
+ /* 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.modkey == 0 && ((keyval >= GDK_1 && keyval <= GDK_9)
|| (keyval == GDK_0 && vb.state.count))) {
/* append the new entered count to previous one */
/* leaf the old mode */
if ((vb.state.mode & VB_MODE_COMPLETE) && !(mode & VB_MODE_COMPLETE)) {
completion_clean();
- }
- switch (clean_old) {
- case VB_MODE_INSERT:
- clean = true;
- dom_clear_focus(vb.gui.webview);
- break;
-
- case VB_MODE_HINTING:
- hints_clear();
- break;
-
- case VB_MODE_SEARCH:
- command_search(&((Arg){VB_SEARCH_OFF}));
- break;
+ } else if ((vb.state.mode & VB_MODE_SEARCH) && !(mode & VB_MODE_SEARCH)) {
+ 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) {
+ clean = true;
+ dom_clear_focus(vb.gui.webview);
}
/* enter the new mode */
break;
case VB_MODE_COMMAND:
- case VB_MODE_HINTING:
gtk_widget_grab_focus(GTK_WIDGET(vb.gui.inputbox));
break;
gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
vb_echo(VB_MSG_NORMAL, false, "-- INPUT --");
break;
-
- case VB_MODE_PATH_THROUGH:
- gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
- break;
}
vb.state.mode = mode;
#endif
#define GET_TEXT() (gtk_entry_get_text(GTK_ENTRY(vb.gui.inputbox)))
-#define CLEAN_MODE(mode) ((mode) & ~(VB_MODE_COMPLETE))
+#define CLEAN_MODE(mode) ((mode) & ~(VB_MODE_COMPLETE | VB_MODE_SEARCH | VB_MODE_HINTING))
#define CLEAR_INPUT() (vb_echo(VB_MSG_NORMAL, ""))
#define PRIMARY_CLIPBOARD() gtk_clipboard_get(GDK_SELECTION_PRIMARY)
#define SECONDARY_CLIPBOARD() gtk_clipboard_get(GDK_NONE)
/* enums */
typedef enum _vb_mode {
+ /* main modes */
VB_MODE_NORMAL = 1<<0,
VB_MODE_COMMAND = 1<<1,
- VB_MODE_PATH_THROUGH = 1<<2,
- VB_MODE_INSERT = 1<<3,
- VB_MODE_SEARCH = 1<<4,
- VB_MODE_COMPLETE = 1<<5,
- VB_MODE_HINTING = 1<<6,
+ VB_MODE_INSERT = 1<<2,
+ /* sub modes */
+ VB_MODE_SEARCH = 1<<3, /* normal mode */
+ VB_MODE_COMPLETE = 1<<4, /* command mode */
+ VB_MODE_HINTING = 1<<5, /* command mode */
} Mode;
enum {