Browse Source

skip add same request value on history argument enabled

CPP-GTK4
yggverse 2 months ago
parent
commit
2c144c3182
  1. 10
      src/app/browser/main/tab/page.cpp
  2. 15
      src/app/browser/main/tab/page/navigation.cpp
  3. 4
      src/app/browser/main/tab/page/navigation.hpp
  4. 18
      src/app/browser/main/tab/page/navigation/history.cpp
  5. 4
      src/app/browser/main/tab/page/navigation/history.hpp

10
src/app/browser/main/tab/page.cpp

@ -160,12 +160,22 @@ void Page::navigation_reload( @@ -160,12 +160,22 @@ void Page::navigation_reload(
) {
// Update navigation history?
if (ADD_HISTORY)
{
// Skip same
Glib::ustring request;
pageNavigation->try_history_current(
request
);
if (request != pageNavigation->get_request_text())
{
pageNavigation->history_add(
pageNavigation->get_request_text(),
true
);
}
}
// Reset page data
mime = MIME::UNDEFINED;

15
src/app/browser/main/tab/page/navigation.cpp

@ -209,6 +209,21 @@ bool Navigation::try_history_back( @@ -209,6 +209,21 @@ bool Navigation::try_history_back(
return false;
}
bool Navigation::try_history_current(
Glib::ustring & request
) {
navigation::History::Memory match;
if (navigationHistory->try_current(match))
{
request = match.request;
return true;
}
return false;
}
bool Navigation::try_history_forward(
Glib::ustring & request,
const bool & UPDATE_MEMORY_INDEX

4
src/app/browser/main/tab/page/navigation.hpp

@ -112,6 +112,10 @@ namespace app::browser::main::tab::page @@ -112,6 +112,10 @@ namespace app::browser::main::tab::page
const bool & UPDATE_MEMORY_INDEX
);
bool try_history_current(
Glib::ustring & request
);
bool try_history_forward(
Glib::ustring & request,
const bool & UPDATE_MEMORY_INDEX

18
src/app/browser/main/tab/page/navigation/history.cpp

@ -189,6 +189,24 @@ bool History::try_back( @@ -189,6 +189,24 @@ bool History::try_back(
}
}
bool History::try_current(
Memory & match
) {
try
{
match = memory.at(
index
);
return true;
}
catch (std::out_of_range)
{
return false;
}
}
bool History::try_forward(
Memory & match,
const bool & UPDATE_MEMORY_INDEX

4
src/app/browser/main/tab/page/navigation/history.hpp

@ -117,6 +117,10 @@ namespace app::browser::main::tab::page::navigation @@ -117,6 +117,10 @@ namespace app::browser::main::tab::page::navigation
const bool & UPDATE_MEMORY_INDEX
);
bool try_current(
Memory & match
);
bool try_forward(
Memory & match,
const bool & UPDATE_MEMORY_INDEX

Loading…
Cancel
Save