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

Dont record locations resulting from typing text


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 84293c75
...@@ -216,6 +216,12 @@ KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc) ...@@ -216,6 +216,12 @@ KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc)
addJump(view->document()->url(), newPosition); addJump(view->document()->url(), newPosition);
}); });
connect(v, &KTextEditor::View::textInserted, this, [this](KTextEditor::View *view, const KTextEditor::Cursor &, const QString &) {
if (view) {
m_textWasInserted = true;
}
});
// register document, it is shown below through showView() then // register document, it is shown below through showView() then
registerDocument(doc); registerDocument(doc);
...@@ -476,6 +482,12 @@ void KateViewSpace::focusNextTab() ...@@ -476,6 +482,12 @@ void KateViewSpace::focusNextTab()
void KateViewSpace::addJump(const QUrl &url, KTextEditor::Cursor c) void KateViewSpace::addJump(const QUrl &url, KTextEditor::Cursor c)
{ {
// are we typing text? => no jump record
if (m_textWasInserted) {
m_textWasInserted = false;
return;
}
// 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
......
...@@ -183,6 +183,7 @@ private: ...@@ -183,6 +183,7 @@ private:
QVector<Location> m_locations; QVector<Location> m_locations;
int currentLocation = 0; int currentLocation = 0;
bool m_textWasInserted = false;
/** /**
* all documents this view space is aware of * all documents this view space is aware of
......
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