From b5fec535fb52d2e64b662354de12c09c0e0288bb Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 13 Apr 2024 06:09:31 +0300 Subject: [PATCH] ignore history record on same URL given --- src/Entity/Tab/Page.php | 6 ++++++ src/Model/History.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/Entity/Tab/Page.php b/src/Entity/Tab/Page.php index e9195b9..94624b6 100644 --- a/src/Entity/Tab/Page.php +++ b/src/Entity/Tab/Page.php @@ -322,6 +322,12 @@ class Page $url ); + // Ignore history record on same URL given + if ($url == $this->history->getCurrent()) + { + $history = false; + } + // Update address field by requested $this->address->set_text( $url diff --git a/src/Model/History.php b/src/Model/History.php index 585b88c..b14e515 100644 --- a/src/Model/History.php +++ b/src/Model/History.php @@ -37,6 +37,13 @@ class History return isset($this->_record[$position]) ? $this->_record[$position] : null; } + public function getCurrent(): ?string + { + return $this->get( + $this->_position + ); + } + public function getBack(): ?string { return $this->get(