diff options
-rw-r--r-- | src/uicmd.cc | 5 | ||||
-rw-r--r-- | src/web.cc | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/uicmd.cc b/src/uicmd.cc index 10b90a50..5e30d72b 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -296,8 +296,8 @@ void CustTabs::switch_tab(CustTabButton *cbtn) // Update window title if ((bw = a_UIcmd_get_bw_by_widget(cbtn->ui()))) { - const char *title = a_History_get_title(NAV_TOP_UIDX(bw), 1); - a_UIcmd_set_page_title(bw, title ? title : ""); + const char *title = (cbtn->ui())->label(); + cbtn->window()->copy_label(title ? title : ""); } } } @@ -1157,6 +1157,7 @@ void a_UIcmd_set_page_title(BrowserWindow *bw, const char *label) uint_t i = MIN(size - 4, 1 + a_Utf8_end_of_char(title, size - 8)); snprintf(title + i, 4, "..."); } + BW2UI(bw)->copy_label(title); BW2UI(bw)->window()->copy_label(title); } BW2UI(bw)->tabs()->set_tab_label(BW2UI(bw), label); @@ -78,8 +78,11 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, /* This method frees the old dw if any */ layout->setWidget(dw); - /* Clear the title bar for pages without a <TITLE> tag */ - a_UIcmd_set_page_title(Web->bw, ""); + /* Set the page title with the bare filename (e.g. for images), + * HTML pages with a <TITLE> tag will overwrite it later */ + const char *p = strrchr(URL_STR(Web->url), '/'); + a_UIcmd_set_page_title(Web->bw, p ? p+1 : ""); + a_UIcmd_set_location_text(Web->bw, URL_STR(Web->url)); /* Reset both progress bars */ a_UIcmd_set_page_prog(Web->bw, 0, 2); |