commit - bc55cdb9b8678689c6f39504ccf17cf1d0f943d5
commit + 55eb4d95383ce078ff680fc9c145359cc030b407
blob - 46a9b460d3f3c93beb6740d499fcfadd415807cd
blob + 32c70afcbbdb043a9d5ad98b3447bb5f376e746b
--- ChangeLog
+++ ChangeLog
2021-08-12 Omar Polo <op@omarpolo.com>
+
+ * cmd.c (cmd_push_button_new_tab): open new tab right after the current one
* telescope.c (load_url): improved reload command: it doesn't push the current url to the history anymore.
blob - 767741497ace904ea7b086af834965318b22d7fd
blob + 85eeb5aaa7f8fd829c100ba6bf310e716396cdfd
--- cmd.c
+++ cmd.c
if (vl == NULL || vl->parent->type != LINE_LINK)
return;
- new_tab(vl->parent->alt, current_tab->hist_cur->h);
+ new_tab(vl->parent->alt, current_tab->hist_cur->h, current_tab);
}
void
if ((url = new_tab_url) == NULL)
url = NEW_TAB_URL;
- new_tab(url, NULL);
+ new_tab(url, NULL, NULL);
}
void
blob - 0bf6e95212e5111ca64597b50810501f53237a9b
blob + d2223ed921f396012bb4c6436115abc2c3920096
--- telescope.c
+++ telescope.c
if ((session = fopen(session_file, "r")) == NULL) {
/* first time? */
- new_tab("about:new", NULL);
- switch_to_tab(new_tab("about:help", NULL));
+ new_tab("about:new", NULL, NULL);
+ switch_to_tab(new_tab("about:help", NULL, NULL));
return;
}
if ((nl = strchr(line, '\n')) != NULL)
*nl = '\0';
parse_session_line(line, &title, &flags);
- if ((tab = new_tab(line, NULL)) == NULL)
+ if ((tab = new_tab(line, NULL, NULL)) == NULL)
err(1, "new_tab");
strlcpy(tab->buffer.page.title, title,
sizeof(tab->buffer.page.title));
switch_to_tab(curr);
if (last_time_crashed())
- switch_to_tab(new_tab("about:crash", NULL));
+ switch_to_tab(new_tab("about:crash", NULL, NULL));
return;
}
if (ui_init()) {
load_last_session();
if (has_url || TAILQ_EMPTY(&tabshead))
- new_tab(url, NULL);
+ new_tab(url, NULL, NULL);
sandbox_ui_process();
ui_main_loop();
blob - 2c550124b6532106073abc2987c978dc57e8a631
blob + 3128c6590eb1ff0691854c1ef52ced466998746a
--- ui.c
+++ ui.c
}
struct tab *
-new_tab(const char *url, const char *base)
+new_tab(const char *url, const char *base, struct tab *after)
{
struct tab *tab;
tab->flags |= TAB_LAZY;
switch_to_tab(tab);
- if (TAILQ_EMPTY(&tabshead))
- TAILQ_INSERT_HEAD(&tabshead, tab, tabs);
- else
- TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
+ if (after != NULL)
+ TAILQ_INSERT_AFTER(&tabshead, after, tab, tabs);
+ else {
+ if (TAILQ_EMPTY(&tabshead))
+ TAILQ_INSERT_HEAD(&tabshead, tab, tabs);
+ else
+ TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
+ }
load_url_in_tab(tab, url, base, 0);
return tab;
blob - d043c8026f06fcfa44dd26e43e5abc4f11700f9e
blob + 0d4ad22b7005186c29b924d57b2036c982d33765
--- ui.h
+++ ui.h
void load_url_in_tab(struct tab *, const char *, const char *, int);
void switch_to_tab(struct tab *);
struct buffer *current_buffer(void);
-struct tab *new_tab(const char *, const char *base);
+struct tab *new_tab(const char *, const char *base, struct tab *);
unsigned int tab_new_id(void);
int ui_print_colors(void);