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

Try to prevent scrolling when staging lines in large diff

Otherwise the view keeps scrolling to the top and one needs to scroll
it down again for every line/hunk one wants to stage/unstage.
parent d134b726
Pipeline #224694 passed with stage
in 7 minutes and 22 seconds
......@@ -14,6 +14,7 @@
#include "kateprojectplugin.h"
#include "kateprojectview.h"
#include "ktexteditor_utils.h"
#include <KTextEditor/Command>
#include <ktexteditor/application.h>
#include <ktexteditor/codecompletioninterface.h>
......@@ -836,14 +837,16 @@ void KateProjectPluginView::showDiffInFixedView(const QByteArray &contents)
m_fixedView.defaultMenu = m_fixedView.view->contextMenu();
}
m_fixedView.view->document()->setText(QString::fromUtf8(contents));
m_fixedView.view->document()->setHighlightingMode(QStringLiteral("Diff"));
auto v = m_fixedView.view;
Utils::KateScrollBarRestorer restorer(v);
v->document()->setText(QString::fromUtf8(contents));
v->document()->setHighlightingMode(QStringLiteral("Diff"));
/** We don't want save dialog on close */
m_fixedView.view->document()->setModified(false);
m_fixedView.view->setCursorPosition({0, 0});
v->document()->setModified(false);
v->setCursorPosition(KTextEditor::Cursor{0, 0});
m_fixedView.restoreMenu();
/** Activate this view */
m_mainWindow->activateView(m_fixedView.view->document());
m_mainWindow->activateView(v->document());
}
void KateProjectPluginView::openTerminal(const QString &dirPath, KateProject *project)
......
Supports Markdown
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