OSDN Git Service

dolphin: disable line numbers for the diff document view
authorIvailo Monev <xakepa10@gmail.com>
Thu, 13 Jul 2023 22:48:07 +0000 (01:48 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Thu, 13 Jul 2023 22:48:07 +0000 (01:48 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
dolphin/plugins/git/gitcommitdialog.cpp

index 9151268..919f619 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <klocale.h>
 #include <kdebug.h>
+#include <KTextEditor/View>
+#include <KTextEditor/ConfigInterface>
 
 #include <git2/buffer.h>
 #include <git2/message.h>
@@ -55,6 +57,11 @@ GitCommitDialog::GitCommitDialog(QWidget *parent)
     if (m_diffdocument) {
         m_diffdocument->setHighlightingMode("Diff");
         KTextEditor::View* diffview = m_diffdocument->createView(m_detailstab);
+        KTextEditor::ConfigInterface* diffconfig = qobject_cast<KTextEditor::ConfigInterface*>(diffview);
+        if (diffconfig) {
+            // line numbers will not represent the line number in the changed file, disable them
+            diffconfig->setConfigValue("line-numbers", false);
+        }
         m_detailstab->addTab((QWidget*)diffview, KIcon("text-x-patch"), i18n("Staged changes"));
     } else {
         kWarning() << "Could not create text editor, using fallback";