commit - e1b01434ff1bad173a8266870731e1df9e646b9f
commit + b1df9b71b9b1ea1d102e827cf7cdb3ed824741a3
blob - 3b35300ae2ccdcb42706916be155dd6a93c83266
blob + dbdb10698208dec844279e376a853e21d2992959
--- ui.c
+++ ui.c
static void cmd_end_of_buffer(struct tab*);
static void cmd_kill_telescope(struct tab*);
static void cmd_push_button(struct tab*);
+static void cmd_push_button_new_tab(struct tab*);
static void cmd_clear_minibuf(struct tab*);
static void cmd_execute_extended_command(struct tab*);
static void cmd_tab_close(struct tab*);
static void enter_minibuffer(void(*)(void), void(*)(void), void(*)(void), struct minibuf_histhead*);
static void exit_minibuffer(void);
static void switch_to_tab(struct tab*);
-static void new_tab(void);
+static struct tab *new_tab(void);
static struct { int meta, key; } thiskey;
/* global */
global_set_key("C-m", cmd_push_button);
+ global_set_key("M-enter", cmd_push_button_new_tab);
/* === minibuffer map === */
minibuffer_set_key("ret", cmd_mini_complete_and_exit);
}
static void
+cmd_push_button_new_tab(struct tab *tab)
+{
+ struct tab *t;
+ struct line *l;
+ size_t nth;
+
+ nth = tab->s->line_off + tab->s->curs_y;
+ if (nth > tab->s->line_max)
+ return;
+ l = nth_line(tab, nth);
+ if (l->type != LINE_LINK)
+ return;
+
+ t = new_tab();
+ memcpy(&t->url, &tab->url, sizeof(tab->url));
+ memcpy(&t->urlstr, &tab->urlstr, sizeof(tab->urlstr));
+ load_url_in_tab(t, l->alt);
+}
+
+static void
cmd_clear_minibuf(struct tab *tab)
{
handle_clear_minibuf(0, 0, NULL);
tab->flags |= TAB_CURRENT;
}
-static void
+static struct tab *
new_tab(void)
{
struct tab *tab, *t;
TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
load_url_in_tab(tab, url);
- return;
+ return tab;
err:
event_loopbreak();
+ return NULL;
}
int