mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-12 13:41:34 +00:00
skip add same request value on history argument enabled
This commit is contained in:
parent
a8c59d5642
commit
2c144c3182
@ -161,10 +161,20 @@ void Page::navigation_reload(
|
||||
// Update navigation history?
|
||||
if (ADD_HISTORY)
|
||||
{
|
||||
pageNavigation->history_add(
|
||||
pageNavigation->get_request_text(),
|
||||
true
|
||||
// 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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…
x
Reference in New Issue
Block a user