1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Show the URI in the title bar even if document title is set.

ECMAcript's window.title overrides this.
This commit is contained in:
witekfl 2011-10-18 20:57:32 +02:00
parent c656c5c929
commit d06cccffd6

View File

@ -35,6 +35,7 @@
#include "document/renderer.h" #include "document/renderer.h"
#include "intl/charsets.h" #include "intl/charsets.h"
#include "osdep/types.h" #include "osdep/types.h"
#include "protocol/protocol.h"
#include "protocol/uri.h" #include "protocol/uri.h"
#include "session/session.h" #include "session/session.h"
#include "terminal/color.h" #include "terminal/color.h"
@ -2411,6 +2412,7 @@ render_html_document(struct cache_entry *cached, struct document *document,
unsigned char *start; unsigned char *start;
unsigned char *end; unsigned char *end;
struct string title; struct string title;
struct string uristring;
struct string head; struct string head;
assert(cached && document); assert(cached && document);
@ -2442,13 +2444,40 @@ render_html_document(struct cache_entry *cached, struct document *document,
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
html_context->doc_cp = document->cp; html_context->doc_cp = document->cp;
if (title.length) { /* setting URI in the title bar */
/* CSM_DEFAULT because init_html_parser() did not if (init_string(&uristring)) {
* decode entities in the title. */ unsigned char *url;
document->title = convert_string(renderer_context.convert_table, enum uri_component components;
title.source, title.length,
if (cached->uri->protocol == PROTOCOL_FILE) {
components = URI_PATH;
} else {
components = URI_PUBLIC;
}
url = get_uri_string(cached->uri, components);
if (url) {
#ifdef CONFIG_UTF8
if (document->options.utf8)
decode_uri(url);
else
#endif /* CONFIG_UTF8 */
decode_uri_for_display(url);
add_to_string(&uristring, url);
add_char_to_string(&uristring, ' ');
mem_free(url);
}
add_string_to_string(&uristring, &title);
if (uristring.length) {
/* CSM_DEFAULT because init_html_parser() did not
* decode entities in the title. */
document->title = convert_string(renderer_context.convert_table,
uristring.source, uristring.length,
document->options.cp, document->options.cp,
CSM_DEFAULT, NULL, NULL, NULL); CSM_DEFAULT, NULL, NULL, NULL);
}
done_string(&uristring);
} }
done_string(&title); done_string(&title);