diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-11 20:15:44 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-11 20:44:02 +0200 |
commit | fd120fb9b09ddd584ff9bf41e9ca0d29c99dd7a0 (patch) | |
tree | be6589d96d7a4a6595c587eb27e83c00049a3a26 /src/html.cc | |
parent | 2c01e5876168eb18166f33e08c819447a57a3e21 (diff) |
Ignore empty page title for tab labels
When a page has an empty title like <title></title>, don't use it to set
the tab label, but instead rely on the default tab label, which is
computed from the file name.
Diffstat (limited to 'src/html.cc')
-rw-r--r-- | src/html.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/html.cc b/src/html.cc index c6aa5b5e..5e1f6ba7 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1706,10 +1706,14 @@ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize) */ static void Html_tag_close_title(DilloHtml *html) { + /* title is only valid inside HEAD */ if (html->InFlags & IN_HEAD && html->Num_TITLE == 1) { - /* title is only valid inside HEAD */ - a_UIcmd_set_page_title(html->bw, html->Stash->str); - a_History_set_title_by_url(html->page_url, html->Stash->str); + /* Ignore empty titles: <title></title> */ + char *title = html->Stash->str; + if (!title || title[0] == '\0') + return; + a_UIcmd_set_page_title(html->bw, title); + a_History_set_title_by_url(html->page_url, title); } } |