From 3a5b99104288d292dc3ab2935617268f335cd455 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Mon, 11 Jan 2021 19:08:48 +0100 Subject: Replace history on redirect --- src/browsertab.cpp | 1 + src/tabbrowsinghistory.cpp | 5 +++++ src/tabbrowsinghistory.hpp | 1 + 3 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index ef3bb48..1682069 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -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 { diff --git a/src/tabbrowsinghistory.cpp b/src/tabbrowsinghistory.cpp index 5f2cba4..5cb03ae 100644 --- a/src/tabbrowsinghistory.cpp +++ b/src/tabbrowsinghistory.cpp @@ -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()) diff --git a/src/tabbrowsinghistory.hpp b/src/tabbrowsinghistory.hpp index 8adee30..c1e20e7 100644 --- a/src/tabbrowsinghistory.hpp +++ b/src/tabbrowsinghistory.hpp @@ -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; -- cgit v1.2.3