From a98470adcbface7e5e7b999a791e8cb44f2cbb8f Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 20 Jun 2023 14:40:02 +0200 Subject: [PATCH] [bookmarks] Added option "document.browse.links.hierbox_goto" . Refs #237 Option is similar to "document.browse.links.target_blank". It is for hierbox dialogs with a "Go to" button. --- src/bfu/hierbox.c | 19 ++++++++++++++++++- src/config/options.inc | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index 8debbe90..0efbbdc0 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -16,6 +16,7 @@ #include "bfu/msgbox.h" #include "bfu/text.h" #include "config/kbdbind.h" +#include "dialogs/menu.h" #include "intl/libintl.h" #include "protocol/uri.h" #include "session/task.h" @@ -522,7 +523,23 @@ push_hierbox_goto_button(struct dialog_data *dlg_data, struct uri *uri = box->ops->get_uri(item); if (uri) { - goto_uri(ses, uri); + int how = get_opt_int("document.browse.links.hierbox_goto", ses); + + switch (how) { + default: + case 0: + goto_uri(ses, uri); + break; + case 1: + open_uri_in_new_tab(ses, uri, 0, 0); + break; + case 2: + open_uri_in_new_tab(ses, uri, 1, 0); + break; + case 3: + open_uri_in_new_window(ses, uri, NULL, ENV_ANY, CACHE_MODE_NORMAL, TASK_NONE); + break; + } done_uri(uri); } diff --git a/src/config/options.inc b/src/config/options.inc index 7c41f51f..0953f535 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -330,6 +330,14 @@ static union option_info config_options_info[] = { N_("Highlight links to directories in FTP and local directory " "listing.")), + INIT_OPT_INT("document.browse.links", N_("Handling of hierbox's Go to button"), + "hierbox_goto", OPT_ZERO, 0, 3, 0, + N_("Define how to handle hierbox's Go to button. For example in bookmarks manager:\n" + "0 means open link in current tab\n" + "1 means open link in new tab in foreground\n" + "2 means open link in new tab in background\n" + "3 means open link in new window")), + INIT_OPT_BOOL("document.browse.links", N_("Number links"), "numbering", OPT_ZERO, 0, N_("Display numbers next to the links.")),