.TP
.BI [ N ][\-[
Follow the last \fIN\fPth link matching `previouspattern'.
+.TP
+.BI m\-{ a-z }
+Set a page mark {\fIa-z\fP} at current possition on page. Such set marks are
+only available on the current page, if the page is left, all marks will be
+removed.
+.TP
+.BI '\-{ a-z }
+Jump to the mark {\fIa-z\fP} on current page.
.SS Hinting
The hinting is the way to do what you would do with the mouse in common
mouse-driven browsers. Open URI, yank URI, save page and so on. If the hinting
/* functions */
static void update_title(void);
static void init_core(void);
+static void marks_clear(void);
static void read_config(void);
static void setup_signals();
static void init_files(void);
vb_update_statusbar();
vb_update_urlbar(uri);
+ /* clear possible set marks */
+ marks_clear();
break;
case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
mode_add('i', input_enter, input_leave, input_keypress, NULL);
mode_add('p', pass_enter, pass_leave, pass_keypress, NULL);
+ /* initialize the marks with empty values */
+ marks_clear();
+
init_files();
session_init();
setting_init();
gtk_widget_show_all(gui->window);
}
+static void marks_clear(void)
+{
+ int i;
+
+ /* init empty marks array */
+ for (i = 0; i < VB_MARK_SIZE; i++) {
+ vb.state.marks[i] = -1;
+ }
+}
+
static void read_config(void)
{
char *line, **lines;
#define VB_WIDGET_SET_STATE(w, s) (gtk_widget_set_state(w, s))
#endif
+#define VB_MARK_CHARS "abcdefghijklmnopqrstuvwxyz"
+#define VB_MARK_SIZE (sizeof(VB_MARK_CHARS) - 1)
+
/* enums */
typedef enum {
RESULT_COMPLETE,
char *title; /* holds the window title */
#define PROMPT_SIZE 4
char prompt[PROMPT_SIZE]; /* current prompt ':', 'g;t', '/' including nul */
+ gdouble marks[VB_MARK_SIZE]; /* holds marks set to page with 'm{markchar}' */
} State;
typedef struct {
static VbResult normal_hint(const NormalCmdInfo *info);
static VbResult normal_do_hint(const char *prompt);
static VbResult normal_input_open(const NormalCmdInfo *info);
+static VbResult normal_mark(const NormalCmdInfo *info);
static VbResult normal_navigate(const NormalCmdInfo *info);
static VbResult normal_open_clipboard(const NormalCmdInfo *info);
static VbResult normal_open(const NormalCmdInfo *info);
/* $ 0x24 */ {normal_scroll},
/* % 0x25 */ {NULL},
/* & 0x26 */ {NULL},
-/* ' 0x27 */ {NULL},
+/* ' 0x27 */ {normal_mark},
/* ( 0x28 */ {NULL},
/* ) 0x29 */ {NULL},
/* * 0x2a */ {normal_search_selection},
/* j 0x6a */ {normal_scroll},
/* k 0x6b */ {normal_scroll},
/* l 0x6c */ {normal_scroll},
-/* m 0x6d */ {NULL},
+/* m 0x6d */ {normal_mark},
/* n 0x6e */ {normal_search},
/* o 0x6f */ {normal_input_open},
/* p 0x70 */ {normal_open_clipboard},
info.phase = PHASE_COMPLETE;
} else if (info.phase == PHASE_START && isdigit(key)) {
info.count = info.count * 10 + key - '0';
- } else if (strchr(";zg[]", (char)key)) {
+ } else if (strchr(";zg[]'m", (char)key)) {
/* handle commands that needs additional char */
info.phase = PHASE_KEY2;
info.key = key;
return RESULT_COMPLETE;
}
+static VbResult normal_mark(const NormalCmdInfo *info)
+{
+ char *mark;
+ int idx;
+ /* check if the second char is a valid mark char */
+ if (!(mark = strchr(VB_MARK_CHARS, info->key2))) {
+ return RESULT_ERROR;
+ }
+
+ /* get the index of the mark char */
+ idx = mark - VB_MARK_CHARS;
+
+ if ('m' == info->key) {
+ vb.state.marks[idx] = gtk_adjustment_get_value(vb.gui.adjust_v);
+ } else {
+ /* check if the mark was set */
+ if ((int)(vb.state.marks[idx] - .5) < 0) {
+ return RESULT_ERROR;
+ }
+ gtk_adjustment_set_value(vb.gui.adjust_v, vb.state.marks[idx]);
+ }
+ return RESULT_COMPLETE;
+}
+
static VbResult normal_navigate(const NormalCmdInfo *info)
{
int count;