diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc index 9626c9dd5..4fcf597be 100644 --- a/src/config/actions-main.inc +++ b/src/config/actions-main.inc @@ -46,6 +46,7 @@ ACTION_(MAIN, "link-download-resume", LINK_DOWNLOAD_RESUME, N__("Attempt to resu ACTION_(MAIN, "link-external-command", LINK_EXTERNAL_COMMAND, N__("Pass URI of current link to external command"), ACTION_RESTRICT_ANONYMOUS | ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), ACTION_(MAIN, "link-follow", LINK_FOLLOW, N__("Follow the current link"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), ACTION_(MAIN, "link-follow-reload", LINK_FOLLOW_RELOAD, N__("Follow the current link, forcing reload of the target"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), +ACTION_(MAIN, "link-info", LINK_INFO, N__("Show information about current link"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), ACTION_(MAIN, "link-menu", LINK_MENU, N__("Open the link context menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), ACTION_(MAIN, "link-form-menu", LINK_FORM_MENU, N__("Open the form fields menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK | ACTION_REQUIRE_FORM), ACTION_(MAIN, "lua-console", LUA_CONSOLE, N__("Open a Lua console"), ACTION_RESTRICT_ANONYMOUS), diff --git a/src/dialogs/document.c b/src/dialogs/document.c index 18136bc81..25a57bc0d 100644 --- a/src/dialogs/document.c +++ b/src/dialogs/document.c @@ -113,6 +113,28 @@ add_link_info_to_string(struct string *msg, struct session *ses) } } +/* Link info message box. */ +void +link_info_dialog(struct session *ses) +{ + struct terminal *term = ses->tab->term; + struct location *location = cur_loc(ses); + struct string msg; + + if (!location) { + nowhere_box(term, NULL); + return; + } + + if (!init_string(&msg)) return; + + add_link_info_to_string(&msg, ses); + + info_box(term, MSGBOX_FREE_TEXT | MSGBOX_SCROLLABLE, + N_("Info"), ALIGN_LEFT, msg.source); +} + + /* Location info. message box. */ void document_info_dialog(struct session *ses) diff --git a/src/dialogs/document.h b/src/dialogs/document.h index c3215bbb8..e6c417067 100644 --- a/src/dialogs/document.h +++ b/src/dialogs/document.h @@ -4,6 +4,7 @@ #include "session/session.h" void nowhere_box(struct terminal *term, unsigned char *title); +void link_info_dialog(struct session *ses); void document_info_dialog(struct session *); void cached_header_dialog(struct session *ses, struct cache_entry *cached); void protocol_header_dialog(struct session *); diff --git a/src/viewer/action.c b/src/viewer/action.c index 5ab0d50d0..6396b39f5 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -305,6 +305,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose) status = enter(ses, doc_view, 1); break; + case ACT_MAIN_LINK_INFO: + link_info_dialog(ses); + break; + case ACT_MAIN_LINK_MENU: link_menu(term, NULL, ses); break; diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index b51697731..a8a003882 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -1284,6 +1284,8 @@ link_menu(struct terminal *term, void *xxx, void *ses_) add_menu_action(&mi, N_("Follow link and r~eload"), ACT_MAIN_LINK_FOLLOW_RELOAD); + add_menu_action(&mi, N_("~Link info"), ACT_MAIN_LINK_INFO); + add_menu_separator(&mi); add_new_win_to_menu(&mi, N_("Open in new ~window"), term);