Commit b968f317 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Fixes for buttons enabling / disabling

parent a5afffd8
...@@ -1204,13 +1204,15 @@ void KateMainWindow::addJump(QUrl url, KTextEditor::Cursor c) ...@@ -1204,13 +1204,15 @@ void KateMainWindow::addJump(QUrl url, KTextEditor::Cursor c)
// we are in the middle of jumps somewhere? // we are in the middle of jumps somewhere?
if (!m_locations.isEmpty() && currentLocation + 1 < m_locations.size()) { if (!m_locations.isEmpty() && currentLocation + 1 < m_locations.size()) {
// erase all forward history // erase all forward history
m_locations.remove(currentLocation + 1, m_locations.size() - (currentLocation + 1)); m_locations.erase(m_locations.begin() + currentLocation + 1, m_locations.end());
// this is our new forward
} }
// this is our new forward
m_locations.push_back({url, c}); m_locations.push_back({url, c});
// set to last // set to last
currentLocation = m_locations.size() - 1; currentLocation = m_locations.size() - 1;
// disable forward button as we are at the end now
setForwardButtonEnabled(false);
// renable back // renable back
if (currentLocation > 0) { if (currentLocation > 0) {
setBackButtonEnabled(true); setBackButtonEnabled(true);
...@@ -1283,6 +1285,7 @@ void KateMainWindow::goBack() ...@@ -1283,6 +1285,7 @@ void KateMainWindow::goBack()
if (m_locations.isEmpty() || currentLocation == 0) { if (m_locations.isEmpty() || currentLocation == 0) {
return; return;
} }
const auto &location = m_locations.at(currentLocation - 1); const auto &location = m_locations.at(currentLocation - 1);
currentLocation--; currentLocation--;
...@@ -1351,6 +1354,8 @@ void KateMainWindow::goForward() ...@@ -1351,6 +1354,8 @@ void KateMainWindow::goForward()
return; return;
} }
setBackButtonEnabled(true);
auto v = openUrl(location.url); auto v = openUrl(location.url);
const QSignalBlocker blocker(v); const QSignalBlocker blocker(v);
v->setCursorPosition(location.cursor); v->setCursorPosition(location.cursor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment