Replace history on redirect

This commit is contained in:
Karol Kosek 2021-01-11 19:08:48 +01:00 committed by Felix Queißner
parent db0202cc36
commit 3a5b991042
3 changed files with 7 additions and 0 deletions

View File

@ -883,6 +883,7 @@ void BrowserTab::on_redirected(QUrl uri, bool is_permanent)
redirection_count += 1;
this->current_location = uri;
this->setUrlBarText(uri.toString(QUrl::FullyEncoded));
this->history.replaceUrl(this->current_history_index.row(), uri);
}
else
{

View File

@ -30,6 +30,11 @@ QModelIndex TabBrowsingHistory::pushUrl(QModelIndex const & position, const QUrl
return this->createIndex(this->history.size() - 1, 0);
}
void TabBrowsingHistory::replaceUrl(size_t const position, QUrl const & url)
{
this->history.replace(position, url);
}
QUrl TabBrowsingHistory::get(const QModelIndex &index) const
{
if(not index.isValid())

View File

@ -17,6 +17,7 @@ public:
bool canGoForward() const;
QModelIndex pushUrl(QModelIndex const & position, QUrl const & url);
void replaceUrl(size_t const position, QUrl const & url);
QUrl get(QModelIndex const & index) const;