New features: page titles, and minor URL bar changes #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Page titles are now supported on Gemini and HTML pages (closes #56), and they are also shown in the window title.
Titles in Gemini documents are extracted in the GeminiRenderer's render function. If the line is a markdown header
#
, the string is copied into a string that is (optionally) passed to the function. This prevents having to re-read the entire document from start to finish just for the title.The HTML title is extracted from the HTML document's
<title>
tag inside a<head>
tag. I figured that only searching in the head would be the best option, as according to this, valid title tags should only appear there. Thus I felt that it'd be less efficient to search past the<head>
tags. The algorithm I've used to get the title should be fairly solid and is capable of ignoring malformed title tags.Finally I added a subtle feature - when clicking the URL bar, all of the text is selected. I've modelled it after the behaviour typical of popular web browsers - i.e the user is still able to select text intuitively without the feature getting in the way.