diff options
author | Marco Peereboom <marco@conformal.com> | 2011-10-26 13:08:40 -0500 |
---|---|---|
committer | Marco Peereboom <marco@conformal.com> | 2011-10-26 13:08:40 -0500 |
commit | f13ae81006a1ff1e5564dc6c8a345b47d3223250 (patch) | |
tree | 4ea3389e02225283dd7cac5cfc4f09e58f9d4966 | |
parent | 3e99b9f07dddfe015a444cb3c04a29ce1af7b4fb (diff) | |
download | xombrero-f13ae81006a1ff1e5564dc6c8a345b47d3223250.tar.gz |
Add hinting that opens in a new tab
Requested by Ingo Feinerer <feinerer@logic.at>
-rw-r--r-- | xxxterm.1 | 3 | ||||
-rw-r--r-- | xxxterm.c | 15 | ||||
-rw-r--r-- | xxxterm.conf | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/xxxterm.1 b/xxxterm.1 index 7b3d5a6..43a1714 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -353,6 +353,9 @@ will follow the link. .It Cm f Highlight all links and prefix them with a number. .Pq Cm hinting +.It Cm F +Highlight all links and prefix them with a number but open in a new tab. +.Pq Cm hinting_newtab .El .Ss Exiting Commands to exit the browser. diff --git a/xxxterm.c b/xxxterm.c index 6b212cd..b3e8cfb 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -248,6 +248,7 @@ struct tab { #define XT_HINT_NONE (0) #define XT_HINT_NUMERICAL (1) #define XT_HINT_ALPHANUM (2) + int new_tab; char hint_buf[128]; char hint_num[128]; @@ -533,6 +534,8 @@ struct karg { #define XT_SESSARG (1<<4) #define XT_SETARG (1<<5) +#define XT_HINT_NEWTAB (1<<0) + #define XT_TABS_NORMAL 0 #define XT_TABS_COMPACT 1 @@ -2376,6 +2379,7 @@ disable_hints(struct tab *t) run_script(t, "vimprobable_clear()"); t->hints_on = 0; t->hint_mode = XT_HINT_NONE; + t->new_tab = 0; } void @@ -2421,6 +2425,10 @@ run_script(struct tab *t, char *s) g_free(es); return (1); } else { + /* if set open in new tab */ + if (t->new_tab) + t->ctrl_click = 1; + es = js_ref_to_string(ctx, val); DNPRINTF(XT_D_JS, "run_script: val %s\n", es); @@ -2453,7 +2461,10 @@ int hint(struct tab *t, struct karg *args) { - DNPRINTF(XT_D_JS, "hint: tab %d\n", t->tab_id); + DNPRINTF(XT_D_JS, "hint: tab %d args %d\n", t->tab_id, args->i); + + if (args->i == XT_HINT_NEWTAB) + t->new_tab = 1; if (t->hints_on == 0) enable_hints(t); @@ -5744,6 +5755,7 @@ struct key_binding { /* hinting */ { "hinting", 0, 0, GDK_f }, + { "hinting_newtab", SHFT, 0, GDK_F }, /* custom stylesheet */ { "userstyle", 0, 0, GDK_i }, @@ -6017,6 +6029,7 @@ struct cmd { /* hinting */ { "hinting", 0, hint, 0, 0 }, + { "hinting_newtab", 0, hint, XT_HINT_NEWTAB, 0 }, /* custom stylesheet */ { "userstyle", 0, userstyle, 0, 0 }, diff --git a/xxxterm.conf b/xxxterm.conf index d5d7238..56826f9 100644 --- a/xxxterm.conf +++ b/xxxterm.conf @@ -186,6 +186,7 @@ # keybinding = prompttabnew,F11 # keybinding = prompttabnewcurrent,F12 # keybinding = hinting,f +# keybinding = hinting_newtab,S-F # keybinding = userstyle,i # keybinding = goback,BackSpace # keybinding = goback,M1-Left |