summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-19 12:01:02 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-19 12:01:02 (GMT)
commit6c48751ad38e461befe40ae64575268a1d94ea46 (patch)
treec85777a9195c02d99cd9e1b6a4f56c431abde1a4
parentf60875167fd807866df33d22a5353b7ad497d2c7 (diff)
EditorPrivate impl, that way we can avoid lots of virtual functions
-rw-r--r--autotests/src/codecompletiontestmodel.cpp2
-rw-r--r--autotests/src/messagetest.cpp2
-rw-r--r--autotests/src/modificationsystem_test.cpp20
-rw-r--r--autotests/src/vimode_test.cpp496
-rw-r--r--src/completion/katewordcompletion.cpp2
-rw-r--r--src/dialogs/katedialogs.cpp12
-rw-r--r--src/document/katebuffer.cpp2
-rw-r--r--src/document/katedocument.cpp38
-rw-r--r--src/include/ktexteditor/editor.h14
-rw-r--r--src/mode/katemodeconfigpage.cpp6
-rw-r--r--src/mode/katemodemenu.cpp10
-rw-r--r--src/printing/printconfigwidgets.cpp2
-rw-r--r--src/schema/kateschema.cpp2
-rw-r--r--src/schema/kateschemaconfig.cpp32
-rw-r--r--src/script/katescriptaction.cpp4
-rw-r--r--src/spellcheck/ontheflycheck.cpp4
-rw-r--r--src/spellcheck/spellcheckdialog.cpp6
-rw-r--r--src/spellcheck/spellingmenu.cpp8
-rw-r--r--src/src/ktexteditor.cpp12
-rw-r--r--src/syntax/katesyntaxmanager.cpp2
-rw-r--r--src/utils/kateautoindent.cpp12
-rw-r--r--src/utils/katecmd.cpp2
-rw-r--r--src/utils/katecmds.cpp8
-rw-r--r--src/utils/kateconfig.cpp16
-rw-r--r--src/utils/kateconfig.h18
-rw-r--r--src/utils/kateglobal.cpp68
-rw-r--r--src/utils/kateglobal.h15
-rw-r--r--src/utils/katetemplatehandler.cpp2
-rw-r--r--src/variableeditor/variablelineedit.cpp4
-rw-r--r--src/view/kateanimation.cpp4
-rw-r--r--src/view/kateview.cpp24
-rw-r--r--src/view/kateviewhelpers.cpp6
-rw-r--r--src/vimode/kateviemulatedcommandbar.cpp24
-rw-r--r--src/vimode/kateviinputmodemanager.cpp18
-rw-r--r--src/vimode/katevikeymapper.cpp6
-rw-r--r--src/vimode/katevimodebase.cpp10
-rw-r--r--src/vimode/katevinormalmode.cpp4
37 files changed, 466 insertions, 451 deletions
diff --git a/autotests/src/codecompletiontestmodel.cpp b/autotests/src/codecompletiontestmodel.cpp
index 3ee5f76..c5733bc 100644
--- a/autotests/src/codecompletiontestmodel.cpp
+++ b/autotests/src/codecompletiontestmodel.cpp
@@ -33,7 +33,7 @@ CodeCompletionTestModel::CodeCompletionTestModel(KTextEditor::View *parent, cons
Q_ASSERT(cc());
cc()->setAutomaticInvocationEnabled(true);
- cc()->unregisterCompletionModel(KateGlobal::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
+ cc()->unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
cc()->registerCompletionModel(this);
}
diff --git a/autotests/src/messagetest.cpp b/autotests/src/messagetest.cpp
index d3c7c3e..76158d1 100644
--- a/autotests/src/messagetest.cpp
+++ b/autotests/src/messagetest.cpp
@@ -34,7 +34,7 @@ QTEST_MAIN(MessageTest)
void MessageTest::initTestCase()
{
- KateGlobal::enableUnitTestMode();
+ KTextEditor::EditorPrivate::enableUnitTestMode();
}
void MessageTest::cleanupTestCase()
diff --git a/autotests/src/modificationsystem_test.cpp b/autotests/src/modificationsystem_test.cpp
index d52d393..1af0aca 100644
--- a/autotests/src/modificationsystem_test.cpp
+++ b/autotests/src/modificationsystem_test.cpp
@@ -60,7 +60,7 @@ static void markModifiedLinesAsSaved(KateDocument *doc)
void ModificationSystemTest::testInsertText()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("first line\n");
doc->setText(content);
@@ -118,7 +118,7 @@ void ModificationSystemTest::testInsertText()
void ModificationSystemTest::testRemoveText()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("first line\n");
doc->setText(content);
@@ -176,7 +176,7 @@ void ModificationSystemTest::testRemoveText()
void ModificationSystemTest::testInsertLine()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("0\n"
"2");
@@ -246,7 +246,7 @@ void ModificationSystemTest::testInsertLine()
void ModificationSystemTest::testRemoveLine()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("0\n"
"1\n"
@@ -315,7 +315,7 @@ void ModificationSystemTest::testWrapLineMid()
{
for (int i = 0; i < 2; ++i) {
bool insertNewLine = (i == 1);
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"bbbb\n"
@@ -387,7 +387,7 @@ void ModificationSystemTest::testWrapLineMid()
void ModificationSystemTest::testWrapLineAtEnd()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"bbbb");
@@ -457,7 +457,7 @@ void ModificationSystemTest::testWrapLineAtEnd()
void ModificationSystemTest::testWrapLineAtStart()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"bbbb");
@@ -527,7 +527,7 @@ void ModificationSystemTest::testWrapLineAtStart()
void ModificationSystemTest::testUnWrapLine()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"bbbb\n"
@@ -594,7 +594,7 @@ void ModificationSystemTest::testUnWrapLine()
void ModificationSystemTest::testUnWrapLine1Empty()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"\n"
@@ -661,7 +661,7 @@ void ModificationSystemTest::testUnWrapLine1Empty()
void ModificationSystemTest::testUnWrapLine2Empty()
{
- KateDocument *doc = qobject_cast<KateDocument *>(KateGlobal::self()->createDocument(0));
+ KateDocument *doc = qobject_cast<KateDocument *>(KTextEditor::EditorPrivate::self()->createDocument(0));
const QString content("aaaa\n"
"\n"
diff --git a/autotests/src/vimode_test.cpp b/autotests/src/vimode_test.cpp
index daee734..3cb73d0 100644
--- a/autotests/src/vimode_test.cpp
+++ b/autotests/src/vimode_test.cpp
@@ -114,7 +114,7 @@ FakeCodeCompletionTestModel::FakeCodeCompletionTestModel(KTextEditor::View *pare
Q_ASSERT(m_kateView);
setRowCount(3);
cc()->setAutomaticInvocationEnabled(false);
- cc()->unregisterCompletionModel(KateGlobal::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
+ cc()->unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
connect(parent->document(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
connect(parent->document(), SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range)),
@@ -2267,20 +2267,20 @@ void ViModeTest::MappingTests()
// Check storage and retrieval of mapping recursion.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello", KateViGlobal::Recursive);
- QVERIFY(KateGlobal::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, "'"));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello", KateViGlobal::Recursive);
+ QVERIFY(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, "'"));
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "ihello", KateViGlobal::NonRecursive);
- QVERIFY(!KateGlobal::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, "a"));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "ihello", KateViGlobal::NonRecursive);
+ QVERIFY(!KTextEditor::EditorPrivate::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, "a"));
}
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "<esc>ihello<esc>^aworld<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "<esc>ihello<esc>^aworld<esc>", KateViGlobal::Recursive);
DoTest("", "'", "hworldello");
// Ensure that the non-mapping logged keypresses are cleared before we execute a mapping
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "rO", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "rO", KateViGlobal::Recursive);
DoTest("X", "'a", "O");
{
@@ -2292,7 +2292,7 @@ void ViModeTest::MappingTests()
QString consectiveDigits;
for (int i = 1; i < 9; i++) {
consectiveDigits += QString::number(i);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'" + consectiveDigits, "iMapped from " + consectiveDigits + "<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'" + consectiveDigits, "iMapped from " + consectiveDigits + "<esc>", KateViGlobal::Recursive);
}
TestPressKey("'123");
QCOMPARE(kate_document->text(), QString("")); // Shouldn't add anything until after the timeout!
@@ -2303,9 +2303,9 @@ void ViModeTest::MappingTests()
// Mappings are not "counted": any count entered applies to the first command/ motion in the mapped sequence,
// and is not used to replay the entire mapped sequence <count> times in a row.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'downmapping", "j", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "ifoo<esc>ibar<esc>", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmotionmapping", "lj", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'downmapping", "j", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "ifoo<esc>ibar<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmotionmapping", "lj", KateViGlobal::Recursive);
DoTest("AAAA\nXXXX\nXXXX\nXXXX\nXXXX\nBBBB\nCCCC\nDDDD", "jd3'downmapping", "AAAA\nBBBB\nCCCC\nDDDD");
DoTest("", "5'testmapping", "foofoofoofoofobaro");
DoTest("XXXX\nXXXX\nXXXX\nXXXX", "3'testmotionmappingrO", "XXXX\nXXXO\nXXXX\nXXXX");
@@ -2315,13 +2315,13 @@ void ViModeTest::MappingTests()
// will mean "go to position 1 percent of the way through the document" rather than
// go to matching item.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gl", "%", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gl", "%", KateViGlobal::Recursive);
DoTest("0\n1\n2\n3\n4\n5\nfoo bar(xyz) baz", "jjjjjjwdgl", "0\n1\n2\n3\n4\n5\nfoo baz");
// Test that countable mappings work even when triggered by timeouts.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "ljrO", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmappingdummy", "dummy", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "ljrO", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmappingdummy", "dummy", KateViGlobal::Recursive);
BeginTest("XXXX\nXXXX\nXXXX\nXXXX");
kate_view->getViInputModeManager()->keyMapper()->setMappingTimeout(mappingTimeoutMS);;
TestPressKey("3'testmapping");
@@ -2331,21 +2331,21 @@ void ViModeTest::MappingTests()
// Test that telescoping mappings don't interfere with built-in commands. Assumes that gp
// is implemented and working.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gdummy", "idummy", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gdummy", "idummy", KateViGlobal::Recursive);
DoTest("hello", "yiwgpx", "hhellollo");
// Test that we can map a sequence of keys that extends a built-in command and use
// that sequence without the built-in command firing.
// Once again, assumes that gp is implemented and working.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gpa", "idummy", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gpa", "idummy", KateViGlobal::Recursive);
DoTest("hello", "yiwgpa", "dummyhello");
// Test that we can map a sequence of keys that extends a built-in command and still
// have the original built-in command fire if we timeout after entering that command.
// Once again, assumes that gp is implemented and working.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gpa", "idummy", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gpa", "idummy", KateViGlobal::Recursive);
BeginTest("hello");
kate_view->getViInputModeManager()->keyMapper()->setMappingTimeout(mappingTimeoutMS);;
TestPressKey("yiwgp");
@@ -2357,17 +2357,17 @@ void ViModeTest::MappingTests()
// (the "g" in the first "dg" is a partial mapping of "gj"), when extended to something
// that is definitely not a mapping ("gg"), results in the full command being executed ("dgg").
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gj", "aj", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gj", "aj", KateViGlobal::Recursive);
DoTest("foo\nbar\nxyz", "jjdgg", "");
// Make sure that a mapped sequence of commands is merged into a single undo-able edit.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "ofoo<esc>ofoo<esc>ofoo<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "ofoo<esc>ofoo<esc>ofoo<esc>", KateViGlobal::Recursive);
DoTest("bar", "'au", "bar");
// Make sure that a counted mapping is merged into a single undoable edit.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "ofoo<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'a", "ofoo<esc>", KateViGlobal::Recursive);
DoTest("bar", "5'au", "bar");
// Some test setup for non-recursive mapping g -> gj (cf: bug:314415)
@@ -2385,35 +2385,35 @@ void ViModeTest::MappingTests()
// Test that non-recursive mappings are not expanded.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "j", "gj", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "j", "gj", KateViGlobal::NonRecursive);
DoTest(multiVirtualLineText, "jrX", expectedAfterVirtualLineDownAndChange);
KateViewConfig::global()->setDynWordWrap(false);
// Test that recursive mappings are expanded.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "rx", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "rx", KateViGlobal::Recursive);
DoTest("foo", "la", "fxo");
// Test that the flag that stops mappings being expanded is reset after the mapping has been executed.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "j", "gj", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "rx", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "j", "gj", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "rx", KateViGlobal::Recursive);
DoTest("foo", "jla", "fxo");
// Even if we start with a recursive mapping, as soon as we hit one that is not recursive, we should stop
// expanding.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "r.", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "i", "a", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "X", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "X", "r.", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "i", "a", KateViGlobal::Recursive);
DoTest("foo", "li", "oo");
// Regression test: Using a mapping may trigger a call to updateSelection(), which can change the mode
// from VisualLineMode to plain VisualMode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "gA", "%", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "gA", "%", KateViGlobal::NonRecursive);
DoTest("xyz\nfoo\n{\nbar\n}", "jVjgAdgglP", "foo\n{\nbar\n}\nxyz");
// Piggy back on the previous test with a regression test for issue where, if gA is mapped to %, vgly
// will yank one more character than it should.
@@ -2421,7 +2421,7 @@ void ViModeTest::MappingTests()
// Make sure that a successful mapping does not break the "if we select stuff externally in Normal mode,
// we should switch to Visual Mode" thing.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gA", "%", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gA", "%", KateViGlobal::NonRecursive);
BeginTest("foo bar xyz()");
TestPressKey("gAr.");
kate_view->setSelection(Range(0, 1, 0, 4)); // Actually selects "oo " (i.e. without the "b").
@@ -2430,24 +2430,24 @@ void ViModeTest::MappingTests()
// Regression tests for BUG:260655
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "f", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "f", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
DoTest("foo dar", "adr.", "foo .ar");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "F", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "F", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
DoTest("foo dar", "$adr.", "foo .ar");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "t", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "t", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
DoTest("foo dar", "adr.", "foo.dar");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "T", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "T", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
DoTest("foo dar", "$adr.", "foo d.r");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "r", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "r", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "d", "i", KateViGlobal::NonRecursive);
DoTest("foo dar", "ad", "doo dar");
// Feel free to map the keypress after that, though.
DoTest("foo dar", "addber\\esc", "berdoo dar");
@@ -2459,7 +2459,7 @@ void ViModeTest::MappingTests()
clearAllMappings();
{
// Ctrl.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><c-b>", "ictrl<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><c-b>", "ictrl<esc>", KateViGlobal::NonRecursive);
BeginTest("");
QKeyEvent *ctrlKeyDown = new QKeyEvent(QEvent::KeyPress, Qt::Key_Control, Qt::NoModifier);
QApplication::postEvent(kate_view->focusProxy(), ctrlKeyDown);
@@ -2473,7 +2473,7 @@ void ViModeTest::MappingTests()
}
{
// Shift.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a>C", "ishift<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a>C", "ishift<esc>", KateViGlobal::NonRecursive);
BeginTest("");
QKeyEvent *ctrlKeyDown = new QKeyEvent(QEvent::KeyPress, Qt::Key_Control, Qt::NoModifier);
QApplication::postEvent(kate_view->focusProxy(), ctrlKeyDown);
@@ -2487,7 +2487,7 @@ void ViModeTest::MappingTests()
}
{
// Alt.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><a-b>", "ialt<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><a-b>", "ialt<esc>", KateViGlobal::NonRecursive);
BeginTest("");
QKeyEvent *ctrlKeyDown = new QKeyEvent(QEvent::KeyPress, Qt::Key_Control, Qt::NoModifier);
QApplication::postEvent(kate_view->focusProxy(), ctrlKeyDown);
@@ -2501,7 +2501,7 @@ void ViModeTest::MappingTests()
}
{
// Meta.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><m-b>", "imeta<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "<c-a><m-b>", "imeta<esc>", KateViGlobal::NonRecursive);
BeginTest("");
QKeyEvent *ctrlKeyDown = new QKeyEvent(QEvent::KeyPress, Qt::Key_Control, Qt::NoModifier);
QApplication::postEvent(kate_view->focusProxy(), ctrlKeyDown);
@@ -2516,50 +2516,50 @@ void ViModeTest::MappingTests()
{
// Can have mappings in Visual mode, distinct from Normal mode..
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "3l", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "inose<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "3l", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "inose<esc>", KateViGlobal::NonRecursive);
DoTest("0123456", "lvad", "056");
// The recursion in Visual Mode is distinct from that of Normal mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "<esc>", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "b", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "b", KateViGlobal::Recursive);
DoTest("XXX\nXXX", "lvajd", "XXX");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "<esc>", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "b", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "b", KateViGlobal::NonRecursive);
DoTest("XXX\nXXX", "lvajd", "XXX\nXXX");
// A Visual mode mapping applies to all Visual modes (line, block, etc).
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "2j", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "2j", KateViGlobal::NonRecursive);
DoTest("123\n456\n789", "lvad", "19");
DoTest("123\n456\n789", "l\\ctrl-vad", "13\n46\n79");
DoTest("123\n456\n789", "lVad", "");
// Same for recursion.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "2j", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "b", "2j", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "a", "b", KateViGlobal::Recursive);
DoTest("123\n456\n789", "lvad", "19");
DoTest("123\n456\n789", "l\\ctrl-vad", "13\n46\n79");
DoTest("123\n456\n789", "lVad", "");
// Can clear Visual mode mappings.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
DoTest("123\n456\n789", "lvhd", "3\n456\n789");
DoTest("123\n456\n789", "l\\ctrl-vhd", "3\n456\n789");
DoTest("123\n456\n789", "lVhd", "456\n789");
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
DoTest("123\n456\n789", "lvhd", "3\n456\n789");
DoTest("123\n456\n789", "l\\ctrl-vhd", "3\n456\n789");
DoTest("123\n456\n789", "lVhd", "456\n789");
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "l", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
DoTest("123\n456\n789", "lvhd", "3\n456\n789");
DoTest("123\n456\n789", "l\\ctrl-vhd", "3\n456\n789");
DoTest("123\n456\n789", "lVhd", "456\n789");
@@ -2567,24 +2567,24 @@ void ViModeTest::MappingTests()
{
// Can have mappings in Insert mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "xyz", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "inose<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "xyz", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "inose<esc>", KateViGlobal::NonRecursive);
DoTest("foo", "ia\\esc", "xyzfoo");
// Recursion for Insert mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "b", "c", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "b", "c", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::NonRecursive);
DoTest("", "ia\\esc", "b");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "b", "c", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "b", "c", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::Recursive);
DoTest("", "ia\\esc", "c");
clearAllMappings();
// Clear mappings for Insert mode.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::InsertModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "a", "b", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::InsertModeMapping);
DoTest("", "ia\\esc", "a");
}
@@ -2592,32 +2592,32 @@ void ViModeTest::MappingTests()
VimStyleCommandBarTestsSetUpAndTearDown vimStyleCommandBarTestsSetUpAndTearDown(kate_view, mainWindow);
// Can have mappings in Emulated Command Bar.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "a", "xyz", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "a", "xyz", KateViGlobal::NonRecursive);
DoTest(" a xyz", "/a\\enterrX", " a Xyz");
// Use mappings from Normal mode as soon as we exit command bar via Enter.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "ixyz<c-c>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "a", "ixyz<c-c>", KateViGlobal::NonRecursive);
DoTest(" a xyz", "/a\\entera", " a xyzxyz");
// Multiple mappings.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "b", "123", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "b", "123", KateViGlobal::NonRecursive);
DoTest(" xyz123", "/ab\\enterrX", " Xyz123");
// Recursive mappings.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "b", "a", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "b", "a", KateViGlobal::Recursive);
DoTest(" xyz", "/b\\enterrX", " Xyz");
// Can clear all.
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::CommandModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::CommandModeMapping);
DoTest(" ab xyz xyz123", "/ab\\enterrX", " Xb xyz xyz123");
}
// Test that not *both* of the mapping and the mapped keys are logged for repetition via "."
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ixyz", "iabc", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gl", "%", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ixyz", "iabc", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "gl", "%", KateViGlobal::NonRecursive);
DoTest("", "ixyz\\esc.", "ababcc");
DoTest("foo()X\nbarxyz()Y", "cglbaz\\escggj.", "bazX\nbazY");
// Regression test for a crash when executing a mapping that switches to Normal mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "d", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "h", "d", KateViGlobal::Recursive);
DoTest("foo", "vlh", "o");
{
@@ -2627,43 +2627,43 @@ void ViModeTest::MappingTests()
// "nn" is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:nn foo l\\foorX", "xXx");
// "no" is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:no foo l\\foorX", "xXx");
// "noremap" is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:noremap foo l\\foorX", "xXx");
// "nm" is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:nm foo l\\foorX", "abXxxx");
// "nmap" is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:nmap foo l\\foorX", "abXxxx");
// Unfortunately, "map" is a reserved word :/
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "l", "iabc<esc>", KateViGlobal::NonRecursive);
DoTest("xxx", "\\:map foo l\\foorX", "abXxxx", ShouldFail, "'map' is reserved for other stuff in Kate command line");
// nunmap works in normal mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "w", "ciwabc<esc>", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "b", "ciwxyz<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "w", "ciwabc<esc>", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "b", "ciwxyz<esc>", KateViGlobal::NonRecursive);
DoTest(" 123 456 789", "\\:nunmap b\\WWwbrX", " 123 Xbc 789");
// vmap works in Visual mode and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("abco", "\\:vmap foo l\\v\\rightfoogU", "co");
// vmap does not work in Normal mode.
@@ -2672,49 +2672,49 @@ void ViModeTest::MappingTests()
// vm works in Visual mode and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("abco", "\\:vm foo l\\v\\rightfoogU", "co");
// vn works in Visual mode and is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("abco", "\\:vn foo l\\v\\rightfoogU", "ABCo");
// vnoremap works in Visual mode and is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("abco", "\\:vnoremap foo l\\v\\rightfoogU", "ABCo");
// vunmap works in Visual Mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "w", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "gU", "2b", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "l", "w", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::VisualModeMapping, "gU", "2b", KateViGlobal::NonRecursive);
DoTest("foo bar xyz", "\\:vunmap gU\\wvlgUd", "foo BAR Xyz");
// imap works in Insert mode and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("", "\\:imap foo l\\ifoo\\esc", "d");
// im works in Insert mode and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("", "\\:im foo l\\ifoo\\esc", "d");
// ino works in Insert mode and is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("", "\\:ino foo l\\ifoo\\esc", "l");
// inoremap works in Insert mode and is not recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest("", "\\:inoremap foo l\\ifoo\\esc", "l");
// iunmap works in Insert mode.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "m", "e", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "m", "e", KateViGlobal::NonRecursive);
DoTest("", "\\:iunmap l\\ilm\\esc", "le");
{
@@ -2724,28 +2724,28 @@ void ViModeTest::MappingTests()
// the emulated command bar (:cmap blah blah\\enter), as this will be subject to mappings, which
// can interfere with the tests!
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest(" l d foo", "\\:cmap foo l\\/foo\\enterrX", " l X foo");
// cm works in emulated command bar and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest(" l d foo", "\\:cm foo l\\/foo\\enterrX", " l X foo");
// cnoremap works in emulated command bar and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest(" l d foo", "\\:cnoremap foo l\\/foo\\enterrX", " X d foo");
// cno works in emulated command bar and is recursive.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
DoTest(" l d foo", "\\:cno foo l\\/foo\\enterrX", " X d foo");
// cunmap works in emulated command bar.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "m", "e", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "l", "d", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::CommandModeMapping, "m", "e", KateViGlobal::NonRecursive);
DoTest(" de le", "\\:cunmap l\\/lm\\enterrX", " de Xe");
}
@@ -2758,8 +2758,8 @@ void ViModeTest::MappingTests()
// be part of a different mapping (but end up not being so).
// (Here, the leading "i" in "irecursive<c-c>" could be part of the mapping "ihello<c-c>").
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
DoTest("", "'", "recursive");
// Capslock in insert mode is not handled by Vim nor by KateViewInternal, and ends up
@@ -3311,13 +3311,13 @@ void ViModeTest::VimStyleCommandBarTests()
// Should work with mappings.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "/c<enter>rX", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'testmapping", "/c<enter>rX", KateViGlobal::Recursive);
BeginTest("acbcd");
TestPressKey("'testmapping");
FinishTest("aXbcd");
clearAllMappings();
// Don't send keys that were part of a mapping to the emulated command bar.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", "/a", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", "/a", KateViGlobal::Recursive);
BeginTest("foo a aH");
TestPressKey("H\\enterrX");
FinishTest("foo X aH");
@@ -3798,8 +3798,8 @@ void ViModeTest::VimStyleCommandBarTests()
// History auto-completion tests.
clearSearchHistory();
QVERIFY(searchHistory().isEmpty());
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
QCOMPARE(searchHistory(), QStringList() << "foo" << "bar");
clearSearchHistory();
QVERIFY(searchHistory().isEmpty());
@@ -3820,8 +3820,8 @@ void ViModeTest::VimStyleCommandBarTests()
QCOMPARE(searchHistory(), QStringList() << "nose");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
QVERIFY(emulatedCommandBarCompleter() != NULL);
BeginTest("foo bar");
TestPressKey("/\\ctrl-p");
@@ -3839,7 +3839,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Don't show completion with an empty search bar.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
BeginTest("foo bar");
TestPressKey("/");
QVERIFY(!emulatedCommandBarCompleter()->popup()->isVisible());
@@ -3848,7 +3848,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Don't auto-complete, either.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
BeginTest("foo bar");
TestPressKey("/f");
QVERIFY(!emulatedCommandBarCompleter()->popup()->isVisible());
@@ -3856,8 +3856,8 @@ void ViModeTest::VimStyleCommandBarTests()
FinishTest("foo bar");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
QVERIFY(emulatedCommandBarCompleter() != NULL);
BeginTest("foo bar");
TestPressKey("/\\ctrl-p");
@@ -3866,9 +3866,9 @@ void ViModeTest::VimStyleCommandBarTests()
FinishTest("foo bar");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
QVERIFY(emulatedCommandBarCompleter() != NULL);
BeginTest("foo bar");
TestPressKey("/\\ctrl-p");
@@ -3891,9 +3891,9 @@ void ViModeTest::VimStyleCommandBarTests()
FinishTest("foo bar");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
QVERIFY(emulatedCommandBarCompleter() != NULL);
BeginTest("foo bar");
TestPressKey("/\\ctrl-n");
@@ -3917,9 +3917,9 @@ void ViModeTest::VimStyleCommandBarTests()
FinishTest("foo bar");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
BeginTest("foo bar");
TestPressKey("/\\ctrl-n\\ctrl-n");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("bar"));
@@ -3929,22 +3929,22 @@ void ViModeTest::VimStyleCommandBarTests()
// If we add something to the history, remove any earliest occurrences (this is what Vim appears to do)
// and append to the end.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
QCOMPARE(searchHistory(), QStringList() << "bar" << "foo" << "xyz");
// Push out older entries if we have too many search items in the history.
const int HISTORY_SIZE_LIMIT = 100;
clearSearchHistory();
for (int i = 1; i <= HISTORY_SIZE_LIMIT; i++) {
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(QString("searchhistoryitem %1").arg(i));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(QString("searchhistoryitem %1").arg(i));
}
QCOMPARE(searchHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(searchHistory().first(), QString("searchhistoryitem 1"));
QCOMPARE(searchHistory().last(), QString("searchhistoryitem 100"));
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(QString("searchhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(QString("searchhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
QCOMPARE(searchHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(searchHistory().first(), QString("searchhistoryitem 2"));
QCOMPARE(searchHistory().last(), QString("searchhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
@@ -4093,7 +4093,7 @@ void ViModeTest::VimStyleCommandBarTests()
// If we're completing from history, though, the entire text gets set, and the completion prefix
// is the beginning of the entire text, not the current word before the cursor.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(bar");
BeginTest("");
TestPressKey("/foo(b\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4105,7 +4105,7 @@ void ViModeTest::VimStyleCommandBarTests()
// If we're completing from history and we abort the completion via ctrl-c or ctrl-[, we revert the whole
// text to the last manually typed text.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(b|ar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(b|ar");
BeginTest("");
TestPressKey("/foo(b\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4231,8 +4231,8 @@ void ViModeTest::VimStyleCommandBarTests()
// Set the completion prefix for the search history completion as soon as it is shown.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(bar");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("foo(bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
BeginTest("");
TestPressKey("/f\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4560,8 +4560,8 @@ void ViModeTest::VimStyleCommandBarTests()
// Command history tests.
clearCommandHistory();
QVERIFY(commandHistory().isEmpty());
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("bar");
QCOMPARE(commandHistory(), QStringList() << "foo" << "bar");
clearCommandHistory();
QVERIFY(commandHistory().isEmpty());
@@ -4569,21 +4569,21 @@ void ViModeTest::VimStyleCommandBarTests()
// If we add something to the history, remove any earliest occurrences (this is what Vim appears to do)
// and append to the end.
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("xyz");
QCOMPARE(commandHistory(), QStringList() << "bar" << "foo" << "xyz");
// Push out older entries if we have too many command items in the history.
clearCommandHistory();
for (int i = 1; i <= HISTORY_SIZE_LIMIT; i++) {
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem(QString("commandhistoryitem %1").arg(i));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem(QString("commandhistoryitem %1").arg(i));
}
QCOMPARE(commandHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(commandHistory().first(), QString("commandhistoryitem 1"));
QCOMPARE(commandHistory().last(), QString("commandhistoryitem 100"));
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem(QString("commandhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem(QString("commandhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
QCOMPARE(commandHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(commandHistory().first(), QString("commandhistoryitem 2"));
QCOMPARE(commandHistory().last(), QString("commandhistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
@@ -4620,8 +4620,8 @@ void ViModeTest::VimStyleCommandBarTests()
// With an empty command bar, ctrl-p / ctrl-n should go through history.
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("command1");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("command2");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("command1");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("command2");
BeginTest("");
TestPressKey(":\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4631,8 +4631,8 @@ void ViModeTest::VimStyleCommandBarTests()
TestPressKey("\\ctrl-c"); // Dismiss bar
FinishTest("");
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("command1");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("command2");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("command1");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("command2");
BeginTest("");
TestPressKey(":\\ctrl-n");
verifyCommandBarCompletionVisible();
@@ -4644,8 +4644,8 @@ void ViModeTest::VimStyleCommandBarTests()
// If we're at a place where command completions are not allowed, ctrl-p/n should go through history.
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command1");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command2");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command1");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command2");
BeginTest("");
TestPressKey(":s/\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4655,8 +4655,8 @@ void ViModeTest::VimStyleCommandBarTests()
TestPressKey("\\ctrl-c"); // Dismiss bar
FinishTest("");
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command1");
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command2");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command1");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("s/command2");
BeginTest("");
TestPressKey(":s/\\ctrl-n");
verifyCommandBarCompletionVisible();
@@ -4679,8 +4679,8 @@ void ViModeTest::VimStyleCommandBarTests()
// "Replace" history tests.
clearReplaceHistory();
QVERIFY(replaceHistory().isEmpty());
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("bar");
QCOMPARE(replaceHistory(), QStringList() << "foo" << "bar");
clearReplaceHistory();
QVERIFY(replaceHistory().isEmpty());
@@ -4688,28 +4688,28 @@ void ViModeTest::VimStyleCommandBarTests()
// If we add something to the history, remove any earliest occurrences (this is what Vim appears to do)
// and append to the end.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("bar");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("foo");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("bar");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("foo");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
QCOMPARE(replaceHistory(), QStringList() << "bar" << "foo" << "xyz");
// Push out older entries if we have too many replace items in the history.
clearReplaceHistory();
for (int i = 1; i <= HISTORY_SIZE_LIMIT; i++) {
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem(QString("replacehistoryitem %1").arg(i));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem(QString("replacehistoryitem %1").arg(i));
}
QCOMPARE(replaceHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(replaceHistory().first(), QString("replacehistoryitem 1"));
QCOMPARE(replaceHistory().last(), QString("replacehistoryitem 100"));
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem(QString("replacehistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem(QString("replacehistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
QCOMPARE(replaceHistory().size(), HISTORY_SIZE_LIMIT);
QCOMPARE(replaceHistory().first(), QString("replacehistoryitem 2"));
QCOMPARE(replaceHistory().last(), QString("replacehistoryitem %1").arg(HISTORY_SIZE_LIMIT + 1));
// Don't add empty replaces to the history.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("");
QVERIFY(replaceHistory().isEmpty());
// Some misc SedReplace tests.
@@ -4810,8 +4810,8 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-f / ctrl-d should cleanly finish sed find/ replace history completion.
clearReplaceHistory();
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("searchxyz");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replacexyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("searchxyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replacexyz");
TestPressKey(":s///g\\ctrl-d\\ctrl-p");
QVERIFY(emulatedCommandBarCompleter()->popup()->isVisible());
TestPressKey("\\ctrl-f");
@@ -4969,7 +4969,7 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-p on the first character of the search term in a sed-replace should
// invoke search history completion.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
BeginTest("");
TestPressKey(":s/search/replace/g\\ctrl-b\\right\\right\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4984,7 +4984,7 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-p on the last character of the search term in a sed-replace should
// invoke search history completion.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
BeginTest("");
TestPressKey(":s/xyz/replace/g\\ctrl-b\\right\\right\\right\\right\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -4999,7 +4999,7 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-p on some arbitrary character of the search term in a sed-replace should
// invoke search history completion.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
BeginTest("");
TestPressKey(":s/xyzaaaaaa/replace/g\\ctrl-b\\right\\right\\right\\right\\right\\right\\right\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5018,7 +5018,7 @@ void ViModeTest::VimStyleCommandBarTests()
clearSearchHistory();
clearCommandHistory();
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyz");
BeginTest("");
TestPressKey(":s/xyz/replace/g\\ctrl-b\\right\\right\\right\\right\\right\\right\\ctrl-p");
QVERIFY(!emulatedCommandBarCompleter()->popup()->isVisible());
@@ -5033,7 +5033,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Make sure it's the search history we're invoking.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
BeginTest("");
TestPressKey(":s//replace/g\\ctrl-b\\right\\right\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5048,9 +5048,9 @@ void ViModeTest::VimStyleCommandBarTests()
// (Search history should be reversed).
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("abc");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("def");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("abc");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("def");
BeginTest("");
TestPressKey(":s//replace/g\\ctrl-b\\right\\right\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5061,11 +5061,11 @@ void ViModeTest::VimStyleCommandBarTests()
// Completion prefix is the current find term.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zaaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("abc");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("def");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zbaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zcaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("abc");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("def");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zbaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xy:zcaaaaa");
BeginTest("");
TestPressKey(":s//replace/g\\ctrl-dxy:z\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5076,8 +5076,8 @@ void ViModeTest::VimStyleCommandBarTests()
// Replace entire search term with completion.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,cd");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,xy");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,cd");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,xy");
BeginTest("");
TestPressKey(":s//replace/g\\ctrl-dab,\\ctrl-p\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/ab,cd/replace/g"));
@@ -5091,7 +5091,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Place the cursor at the end of find term.
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,xy");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("ab,xy");
BeginTest("");
TestPressKey(":s//replace/g\\ctrl-dab,\\ctrl-pX");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/ab,xyX/replace/g"));
@@ -5126,7 +5126,7 @@ void ViModeTest::VimStyleCommandBarTests()
clearSearchHistory();
clearReplaceHistory();
clearCommandHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
BeginTest("");
TestPressKey(":s/search/replace/g\\left\\left\\left\\left\\left\\left\\left\\left\\left\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5141,7 +5141,7 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-p on the last character of the replace term in a sed-replace should
// invoke replace history completion.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
BeginTest("");
TestPressKey(":s/xyz/replace/g\\left\\left\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5156,7 +5156,7 @@ void ViModeTest::VimStyleCommandBarTests()
// ctrl-p on some arbitrary character of the search term in a sed-replace should
// invoke search history completion.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replaceaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replaceaaaaaa");
BeginTest("");
TestPressKey(":s/xyzaaaaaa/replace/g\\left\\left\\left\\left\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5175,7 +5175,7 @@ void ViModeTest::VimStyleCommandBarTests()
clearSearchHistory();
clearCommandHistory();
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyz");
BeginTest("");
TestPressKey(":s/xyz/replace/g\\left\\ctrl-p");
QVERIFY(!emulatedCommandBarCompleter()->popup()->isVisible());
@@ -5190,9 +5190,9 @@ void ViModeTest::VimStyleCommandBarTests()
// (Replace history should be reversed).
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyzaaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("abc");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("def");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xyzaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("abc");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("def");
BeginTest("");
TestPressKey(":s/search//g\\left\\left\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5203,11 +5203,11 @@ void ViModeTest::VimStyleCommandBarTests()
// Completion prefix is the current replace term.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zaaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("abc");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("def");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zbaaaaa");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zcaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zaaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("abc");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("def");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zbaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("xy:zcaaaaa");
BeginTest("");
TestPressKey(":'<,'>s/replace/search/g\\ctrl-fxy:z\\ctrl-p");
verifyCommandBarCompletionVisible();
@@ -5219,8 +5219,8 @@ void ViModeTest::VimStyleCommandBarTests()
// Replace entire search term with completion.
clearReplaceHistory();
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,cd");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,cd");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
BeginTest("");
TestPressKey(":s/search//g\\ctrl-fab,\\ctrl-p\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/search/ab,cd/g"));
@@ -5234,7 +5234,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Place the cursor at the end of replace term.
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
BeginTest("");
TestPressKey(":s/search//g\\ctrl-fab,\\ctrl-pX");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/search/ab,xyX/g"));
@@ -5268,8 +5268,8 @@ void ViModeTest::VimStyleCommandBarTests()
BeginTest("");
clearReplaceHistory();
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("whoops");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ab,xy");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("whoops");
TestPressKey(":s///g\\ctrl-f\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s//ab,xy/g"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5279,7 +5279,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Move the cursor back to the last manual edit point when aborting completion.
BeginTest("");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("xyzaaaaa");
TestPressKey(":s/xyz/replace/g\\ctrl-b\\right\\right\\right\\right\\righta\\ctrl-p\\ctrl-[X");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/xyzaX/replace/g"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5290,7 +5290,7 @@ void ViModeTest::VimStyleCommandBarTests()
// current "find" term.
BeginTest("");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("doesnothavexyzasaprefix");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("doesnothavexyzasaprefix");
TestPressKey(":s//replace/g\\ctrl-dxyz\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/xyz/replace/g"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5301,9 +5301,9 @@ void ViModeTest::VimStyleCommandBarTests()
// work, but at least it won't crash!
BeginTest("");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("aa/aa\\/a");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("ss/ss");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("aa/aa\\/a");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("ss/ss");
TestPressKey(":s//replace/g\\ctrl-d\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/ss\\/ss/replace/g"));
TestPressKey("\\ctrl-p");
@@ -5313,9 +5313,9 @@ void ViModeTest::VimStyleCommandBarTests()
TestPressKey("\\ctrl-c"); // Dismiss completer
TestPressKey("\\ctrl-c"); // Dismiss bar.
clearSearchHistory(); // Now do the same, but with a different delimiter.
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("aa:aa\\:a");
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("ss:ss");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("search");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("aa:aa\\:a");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("ss:ss");
TestPressKey(":s::replace:g\\ctrl-d\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s:ss\\:ss:replace:g"));
TestPressKey("\\ctrl-p");
@@ -5329,7 +5329,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Remove \C if occurs in search history.
BeginTest("");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("s\\Cear\\\\Cch");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("s\\Cear\\\\Cch");
TestPressKey(":s::replace:g\\ctrl-d\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s:sear\\\\Cch:replace:g"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5340,7 +5340,7 @@ void ViModeTest::VimStyleCommandBarTests()
// current "replace" term.
BeginTest("");
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("doesnothavexyzasaprefix");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("doesnothavexyzasaprefix");
TestPressKey(":s/search//g\\ctrl-fxyz\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/search/xyz/g"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5351,9 +5351,9 @@ void ViModeTest::VimStyleCommandBarTests()
// work, but at least it won't crash!
BeginTest("");
clearReplaceHistory();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("aa/aa\\/a");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ss/ss");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("aa/aa\\/a");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ss/ss");
TestPressKey(":s/search//g\\ctrl-f\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s/search/ss\\/ss/g"));
TestPressKey("\\ctrl-p");
@@ -5363,9 +5363,9 @@ void ViModeTest::VimStyleCommandBarTests()
TestPressKey("\\ctrl-c"); // Dismiss completer
TestPressKey("\\ctrl-c"); // Dismiss bar.
clearReplaceHistory(); // Now do the same, but with a different delimiter.
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("aa:aa\\:a");
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem("ss:ss");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("replace");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("aa:aa\\:a");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem("ss:ss");
TestPressKey(":s:search::g\\ctrl-f\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("s:search:ss\\:ss:g"));
TestPressKey("\\ctrl-p");
@@ -5380,7 +5380,7 @@ void ViModeTest::VimStyleCommandBarTests()
// has the current text as a prefix.
BeginTest("");
clearSearchHistory();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem("doesnothavexyzasaprefix");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem("doesnothavexyzasaprefix");
TestPressKey("/xyz\\ctrl-p");
QCOMPARE(emulatedCommandBarTextEdit()->text(), QString("xyz"));
TestPressKey("\\ctrl-c"); // Dismiss completer
@@ -5398,7 +5398,7 @@ void ViModeTest::VimStyleCommandBarTests()
// Don't expand mappings meant for Normal mode in the emulated command bar.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "foo", "xyz", KateViGlobal::NonRecursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "foo", "xyz", KateViGlobal::NonRecursive);
DoTest("bar foo xyz", "/foo\\enterrX", "bar Xoo xyz");
clearAllMappings();
@@ -5906,7 +5906,7 @@ void ViModeTest::VimStyleCommandBarTests()
if (printAction) {
printAction->blockSignals(true);
}
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem("s/foo/bar/caa");
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem("s/foo/bar/caa");
BeginTest("foo");
TestPressKey(":s/foo/bar/c\\ctrl-b\\enter\\ctrl-p");
QVERIFY(!emulatedCommandBarCompleter()->popup()->isVisible());
@@ -5932,13 +5932,13 @@ void ViModeTest::VimStyleCommandBarTests()
// Should be usable in mappings.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nnyyl", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nnyyl", KateViGlobal::Recursive);
DoTest("foo foo foo foo foo foo", "H", "foo foo bar bar bar foo");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nna", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nna", KateViGlobal::Recursive);
DoTest("foo foo foo foo foo foo", "H", "foo foo bar bar bar bar");
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nnyqggidone<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "H", ":s/foo/bar/gc<enter>nnyqggidone<esc>", KateViGlobal::Recursive);
DoTest("foo foo foo foo foo foo", "H", "donefoo foo bar foo foo foo");
// Don't swallow "Ctrl+<key>" meant for the text edit.
@@ -5961,7 +5961,7 @@ public:
{
setRowCount(3);
cc()->setAutomaticInvocationEnabled(true);
- cc()->unregisterCompletionModel(KateGlobal::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
+ cc()->unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
cc()->registerCompletionModel(this);
}
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
@@ -5989,7 +5989,7 @@ public:
{
setRowCount(3);
cc()->setAutomaticInvocationEnabled(true);
- cc()->unregisterCompletionModel(KateGlobal::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
+ cc()->unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()); //would add additional items, we don't want that in tests
cc()->registerCompletionModel(this);
}
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
@@ -6077,7 +6077,7 @@ void ViModeTest::CompletionTests()
// Make sure the "Enter"/ "Return" used when invoking completions is not swallowed before being
// passed to the key mapper.
kate_view->registerCompletionModel(testModel);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "cb", "mapped-shouldntbehere", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::InsertModeMapping, "cb", "mapped-shouldntbehere", KateViGlobal::Recursive);
BeginTest("");
TestPressKey("ic");
kate_view->userInvokedCompletion();
@@ -6481,34 +6481,34 @@ void ViModeTest::MacroTests()
// Expand mappings, but don't do *both* original keypresses and executed keypresses.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
clearAllMacros();
DoTest("", "qa'q@a", "hellhelloo");
// Actually, just do the mapped keypresses, not the executed mappings (like Vim).
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
clearAllMacros();
BeginTest("");
TestPressKey("qa'q");
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "igoodbye<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "igoodbye<c-c>", KateViGlobal::Recursive);
TestPressKey("@a");
FinishTest("hellgoodbyeo");
// Clear the "stop recording macro keypresses because we're executing a mapping" when the mapping has finished
// executing.
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
clearAllMacros();
DoTest("", "qa'ixyz\\ctrl-cq@a", "hellxyhellxyzozo");
// ... make sure that *all* mappings have finished, though: take into account recursion.
clearAllMappings();
clearAllMacros();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
DoTest("", "qa'q@a", "recursivrecursivee");
clearAllMappings();
clearAllMacros();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>ixyz<c-c>", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "'", "ihello<c-c>ixyz<c-c>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "ihello<c-c>", "irecursive<c-c>", KateViGlobal::Recursive);
DoTest("", "qa'q@a", "recursivxyrecursivxyzeze");
clearAllMappings();
@@ -6555,8 +6555,8 @@ void ViModeTest::MacroTests()
clearAllMacros();
// Expand mapping in an executed macro, if the invocation of the macro "@a" is a prefix of a mapping M, and
// M ends up not being triggered.
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "@aaaa", "idummy<esc>", KateViGlobal::Recursive);
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "S", "ixyz<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "@aaaa", "idummy<esc>", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "S", "ixyz<esc>", KateViGlobal::Recursive);
DoTest("", "qaSq@abrX", "Xyxyzz");
clearAllMappings();
@@ -6593,11 +6593,11 @@ void ViModeTest::MacroTests()
KConfigGroup viTestKConfigGroup(&viTestKConfig, "Kate Vi Test Stuff");
BeginTest("");
TestPressKey("qaia\\ctrl-cq");
- KateGlobal::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
viTestKConfig.sync();
// Overwrite macro "a", and clear the document.
TestPressKey("qaidummy\\ctrl-cqdd");
- KateGlobal::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
TestPressKey("@a");
FinishTest("a");
}
@@ -6610,11 +6610,11 @@ void ViModeTest::MacroTests()
KConfigGroup viTestKConfigGroup(&viTestKConfig, "Kate Vi Test Stuff");
BeginTest("");
TestPressKey("qaia\\ctrl-cqqbib\\ctrl-cq");
- KateGlobal::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
viTestKConfig.sync();
// Overwrite macros "a" & "b", and clear the document.
TestPressKey("qaidummy\\ctrl-cqqbidummy\\ctrl-cqdd");
- KateGlobal::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
TestPressKey("@a@b");
FinishTest("ba");
}
@@ -7155,7 +7155,7 @@ void ViModeTest::MacroTests()
fakeCodeCompletionModel->setCompletions(QStringList() << "completionB" << "semicolonfunctionnoargs();" << "semicolonfunctionwithargs(...);");
TestPressKey("\\enterqbea\\ctrl- \\enter\\ctrl-cosemicolonfunctionw\\ctrl- \\enterX\\ctrl-cosemicolonfunctionn\\ctrl- \\enterX\\ctrl-cq");
// Save.
- KateGlobal::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->writeConfig(viTestKConfigGroup);
viTestKConfig.sync();
// Overwrite 'a' and 'b' and their completions.
fakeCodeCompletionModel->setCompletions(QStringList() << "blah1");
@@ -7163,7 +7163,7 @@ void ViModeTest::MacroTests()
TestPressKey("ggqaiblah\\ctrl- \\enter\\ctrl-cq");
TestPressKey("ddqbiblah\\ctrl- \\enter\\ctrl-cq");
// Reload.
- KateGlobal::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->readConfig(viTestKConfigGroup);
// Replay reloaded.
fakeCodeCompletionModel->setFailTestOnInvocation(true);
kate_document->setText("funct\nnoa\ncomtail\ncomtail\ncom");
@@ -7309,45 +7309,45 @@ void ViModeTest::verifyTextEditBackgroundColour(const QColor &expectedBackground
void ViModeTest::clearAllMappings()
{
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::NormalModeMapping);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::InsertModeMapping);
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::CommandModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::NormalModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::VisualModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::InsertModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::CommandModeMapping);
}
void ViModeTest::clearSearchHistory()
{
- KateGlobal::self()->viInputModeGlobal()->clearSearchHistory();
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearSearchHistory();
}
QStringList ViModeTest::searchHistory()
{
- return KateGlobal::self()->viInputModeGlobal()->searchHistory();
+ return KTextEditor::EditorPrivate::self()->viInputModeGlobal()->searchHistory();
}
void ViModeTest::clearCommandHistory()
{
- KateGlobal::self()->viInputModeGlobal()->clearCommandHistory();
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearCommandHistory();
}
QStringList ViModeTest::commandHistory()
{
- return KateGlobal::self()->viInputModeGlobal()->commandHistory();
+ return KTextEditor::EditorPrivate::self()->viInputModeGlobal()->commandHistory();
}
void ViModeTest::clearReplaceHistory()
{
- KateGlobal::self()->viInputModeGlobal()->clearReplaceHistory();
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearReplaceHistory();
}
QStringList ViModeTest::replaceHistory()
{
- return KateGlobal::self()->viInputModeGlobal()->replaceHistory();
+ return KTextEditor::EditorPrivate::self()->viInputModeGlobal()->replaceHistory();
}
void ViModeTest::clearAllMacros()
{
- KateGlobal::self()->viInputModeGlobal()->clearAllMacros();
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearAllMacros();
}
QCompleter *ViModeTest::emulatedCommandBarCompleter()
@@ -7439,7 +7439,7 @@ void ViModeTest::keyParsingTests()
// Test that it can be used in mappings
clearAllMappings();
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, char_o_diaeresis, "ifoo", KateViGlobal::Recursive);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, char_o_diaeresis, "ifoo", KateViGlobal::Recursive);
DoTest("hello", QString("ll%1bar").arg(char_o_diaeresis), "hefoobarllo");
}
diff --git a/src/completion/katewordcompletion.cpp b/src/completion/katewordcompletion.cpp
index b7b60cc..ae1204b 100644
--- a/src/completion/katewordcompletion.cpp
+++ b/src/completion/katewordcompletion.cpp
@@ -318,7 +318,7 @@ struct KateWordCompletionViewPrivate {
KateWordCompletionView::KateWordCompletionView(KTextEditor::View *view, KActionCollection *ac)
: QObject(view),
m_view(view),
- m_dWCompletionModel(KateGlobal::self()->wordCompletionModel()),
+ m_dWCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel()),
d(new KateWordCompletionViewPrivate)
{
d->isCompleting = false;
diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp
index bd87e3e..bfb3abe 100644
--- a/src/dialogs/katedialogs.cpp
+++ b/src/dialogs/katedialogs.cpp
@@ -369,7 +369,7 @@ void KateViInputModeConfigTab::apply()
KateViewConfig::global()->configStart();
KateViewConfig::global()->setViInputMode(ui->chkViInputModeDefault->isChecked());
KateViewConfig::global()->setViInputModeStealKeys(ui->chkViCommandsOverride->isChecked());
- KateGlobal::self()->viInputModeGlobal()->clearMappings(KateViGlobal::NormalModeMapping);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMappings(KateViGlobal::NormalModeMapping);
for (int i = 0; i < ui->tblNormalModeMappings->rowCount(); i++) {
QTableWidgetItem *from = ui->tblNormalModeMappings->item(i, 0);
QTableWidgetItem *to = ui->tblNormalModeMappings->item(i, 1);
@@ -379,7 +379,7 @@ void KateViInputModeConfigTab::apply()
const KateViGlobal::MappingRecursion recursion = recursive->checkState() == Qt::Checked ?
KateViGlobal::Recursive :
KateViGlobal::NonRecursive;
- KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, from->text(), to->text(), recursion);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, from->text(), to->text(), recursion);
}
}
KateViewConfig::global()->configEnd();
@@ -392,7 +392,7 @@ void KateViInputModeConfigTab::reload()
ui->chkViCommandsOverride->setEnabled(ui->chkViInputModeDefault->isChecked());
- QStringList l = KateGlobal::self()->viInputModeGlobal()->getMappings(KateViGlobal::NormalModeMapping);
+ QStringList l = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMappings(KateViGlobal::NormalModeMapping);
ui->tblNormalModeMappings->setRowCount(l.size());
// Make the two columns fill most of the width.
@@ -406,13 +406,13 @@ void KateViInputModeConfigTab::reload()
foreach (const QString &f, l) {
QTableWidgetItem *from
= new QTableWidgetItem(KateViKeyParser::self()->decodeKeySequence(f));
- QString s = KateGlobal::self()->viInputModeGlobal()->getMapping(KateViGlobal::NormalModeMapping, f);
+ QString s = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMapping(KateViGlobal::NormalModeMapping, f);
QTableWidgetItem *to =
new QTableWidgetItem(KateViKeyParser::self()->decodeKeySequence(s));
QTableWidgetItem *recursive =
new QTableWidgetItem();
recursive->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
- const bool isRecursive = KateGlobal::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, f);
+ const bool isRecursive = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::NormalModeMapping, f);
recursive->setCheckState(isRecursive ? Qt::Checked : Qt::Unchecked);
ui->tblNormalModeMappings->setItem(i, 0, from);
@@ -526,7 +526,7 @@ void KateSpellCheckConfigTab::apply()
KateDocumentConfig::global()->configStart();
m_sonnetConfigWidget->save();
KateDocumentConfig::global()->configEnd();
- foreach (KateDocument *doc, KateGlobal::self()->kateDocuments()) {
+ foreach (KateDocument *doc, KTextEditor::EditorPrivate::self()->kateDocuments()) {
doc->refreshOnTheFlyCheck();
}
}
diff --git a/src/document/katebuffer.cpp b/src/document/katebuffer.cpp
index d207185..cb903f5 100644
--- a/src/document/katebuffer.cpp
+++ b/src/document/katebuffer.cpp
@@ -386,7 +386,7 @@ void KateBuffer::doHighlight(int startLine, int endLine, bool invalidate)
// avoid recursive invalidation
KateHlManager::self()->setForceNoDCReset(true);
- foreach (KateDocument *doc, KateGlobal::self()->kateDocuments()) {
+ foreach (KateDocument *doc, KTextEditor::EditorPrivate::self()->kateDocuments()) {
doc->makeAttribs();
}
diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp
index 21ac851..c635f2e 100644
--- a/src/document/katedocument.cpp
+++ b/src/document/katedocument.cpp
@@ -136,7 +136,7 @@ KateDocument::KateDocument(bool bSingleViewMode,
m_readWriteStateBeforeLoading(false),
m_isUntitled(true)
{
- setComponentData(KateGlobal::self()->aboutData());
+ setComponentData(KTextEditor::EditorPrivate::self()->aboutData());
/**
* avoid spamming plasma and other window managers with progress dialogs
@@ -151,7 +151,7 @@ KateDocument::KateDocument(bool bSingleViewMode,
QDBusConnection::sessionBus().registerObject(pathName, this, QDBusConnection::ExportAdaptors | QDBusConnection::ExportScriptableSlots);
// register doc at factory
- KateGlobal::self()->registerDocument(this);
+ KTextEditor::EditorPrivate::self()->registerDocument(this);
// normal hl
m_buffer->setHighlight(0);
@@ -169,13 +169,13 @@ KateDocument::KateDocument(bool bSingleViewMode,
connect(KateHlManager::self(), SIGNAL(changed()), SLOT(internalHlChanged()));
// signals for mod on hd
- connect(KateGlobal::self()->dirWatch(), SIGNAL(dirty(QString)),
+ connect(KTextEditor::EditorPrivate::self()->dirWatch(), SIGNAL(dirty(QString)),
this, SLOT(slotModOnHdDirty(QString)));
- connect(KateGlobal::self()->dirWatch(), SIGNAL(created(QString)),
+ connect(KTextEditor::EditorPrivate::self()->dirWatch(), SIGNAL(created(QString)),
this, SLOT(slotModOnHdCreated(QString)));
- connect(KateGlobal::self()->dirWatch(), SIGNAL(deleted(QString)),
+ connect(KTextEditor::EditorPrivate::self()->dirWatch(), SIGNAL(deleted(QString)),
this, SLOT(slotModOnHdDeleted(QString)));
/**
@@ -253,7 +253,7 @@ KateDocument::~KateDocument()
m_marks.clear();
delete m_config;
- KateGlobal::self()->deregisterDocument(this);
+ KTextEditor::EditorPrivate::self()->deregisterDocument(this);
}
//END
@@ -1554,7 +1554,7 @@ QStringList KateDocument::modes() const
{
QStringList m;
- const QList<KateFileType *> &modeList = KateGlobal::self()->modeManager()->list();
+ const QList<KateFileType *> &modeList = KTextEditor::EditorPrivate::self()->modeManager()->list();
foreach (KateFileType *type, modeList) {
m << type->name;
}
@@ -1595,7 +1595,7 @@ QString KateDocument::highlightingModeSection(int index) const
QString KateDocument::modeSection(int index) const
{
- return KateGlobal::self()->modeManager()->list().at(index)->section;
+ return KTextEditor::EditorPrivate::self()->modeManager()->list().at(index)->section;
}
void KateDocument::bufferHlChanged()
@@ -2042,7 +2042,7 @@ bool KateDocument::openFile()
emit KTextEditor::Document::textRemoved(this, documentRange(), m_buffer->text());
// update file type, we do this here PRE-LOAD, therefore pass file name for reading from
- updateFileType(KateGlobal::self()->modeManager()->fileType(this, localFilePath()));
+ updateFileType(KTextEditor::EditorPrivate::self()->modeManager()->fileType(this, localFilePath()));
// read dir config (if possible and wanted)
// do this PRE-LOAD to get encoding info!
@@ -2252,7 +2252,7 @@ bool KateDocument::saveFile()
}
// update file type, pass no file path, read file type content from this document
- updateFileType(KateGlobal::self()->modeManager()->fileType(this, QString()));
+ updateFileType(KTextEditor::EditorPrivate::self()->modeManager()->fileType(this, QString()));
// remember the oldpath...
QString oldPath = m_dirWatchFile;
@@ -2381,7 +2381,7 @@ void KateDocument::activateDirWatch(const QString &useFileName)
// add new file if needed
if (url().isLocalFile() && !fileToUse.isEmpty()) {
- KateGlobal::self()->dirWatch()->addFile(fileToUse);
+ KTextEditor::EditorPrivate::self()->dirWatch()->addFile(fileToUse);
m_dirWatchFile = fileToUse;
}
}
@@ -2389,7 +2389,7 @@ void KateDocument::activateDirWatch(const QString &useFileName)
void KateDocument::deactivateDirWatch()
{
if (!m_dirWatchFile.isEmpty()) {
- KateGlobal::self()->dirWatch()->removeFile(m_dirWatchFile);
+ KTextEditor::EditorPrivate::self()->dirWatch()->removeFile(m_dirWatchFile);
}
m_dirWatchFile.clear();
@@ -2592,7 +2592,7 @@ void KateDocument::addView(KTextEditor::View *view)
// apply the view & renderer vars from the file type
if (!m_fileType.isEmpty()) {
- readVariableLine(KateGlobal::self()->modeManager()->fileType(m_fileType).varLine, true);
+ readVariableLine(KTextEditor::EditorPrivate::self()->modeManager()->fileType(m_fileType).varLine, true);
}
// apply the view & renderer vars from the file
@@ -3728,7 +3728,7 @@ void KateDocument::updateDocName()
int count = -1;
- foreach (KateDocument *doc, KateGlobal::self()->kateDocuments()) {
+ foreach (KateDocument *doc, KTextEditor::EditorPrivate::self()->kateDocuments()) {
if ((doc != this) && (doc->url().fileName() == url().fileName()))
if (doc->m_docNameNumber > count) {
count = doc->m_docNameNumber;
@@ -4551,8 +4551,8 @@ void KateDocument::updateFileType(const QString &newType, bool user)
m_config->configStart();
- if (!m_hlSetByUser && !KateGlobal::self()->modeManager()->fileType(newType).hl.isEmpty()) {
- int hl(KateHlManager::self()->nameFind(KateGlobal::self()->modeManager()->fileType(newType).hl));
+ if (!m_hlSetByUser && !KTextEditor::EditorPrivate::self()->modeManager()->fileType(newType).hl.isEmpty()) {
+ int hl(KateHlManager::self()->nameFind(KTextEditor::EditorPrivate::self()->modeManager()->fileType(newType).hl));
if (hl >= 0) {
m_buffer->setHighlight(hl);
@@ -4563,8 +4563,8 @@ void KateDocument::updateFileType(const QString &newType, bool user)
* set the indentation mode, if any in the mode...
* and user did not set it before!
*/
- if (!m_indenterSetByUser && !KateGlobal::self()->modeManager()->fileType(newType).indenter.isEmpty()) {
- config()->setIndentationMode(KateGlobal::self()->modeManager()->fileType(newType).indenter);
+ if (!m_indenterSetByUser && !KTextEditor::EditorPrivate::self()->modeManager()->fileType(newType).indenter.isEmpty()) {
+ config()->setIndentationMode(KTextEditor::EditorPrivate::self()->modeManager()->fileType(newType).indenter);
}
// views!
@@ -4578,7 +4578,7 @@ void KateDocument::updateFileType(const QString &newType, bool user)
if (m_bomSetByUser) {
bom_settings = m_config->bom();
}
- readVariableLine(KateGlobal::self()->modeManager()->fileType(newType).varLine);
+ readVariableLine(KTextEditor::EditorPrivate::self()->modeManager()->fileType(newType).varLine);
if (m_bomSetByUser) {
m_config->setBom(bom_settings);
}
diff --git a/src/include/ktexteditor/editor.h b/src/include/ktexteditor/editor.h
index 0ef3aec..875c3c6 100644
--- a/src/include/ktexteditor/editor.h
+++ b/src/include/ktexteditor/editor.h
@@ -33,6 +33,7 @@ namespace KTextEditor
class Application;
class Document;
+class EditorPrivate;
/**
* \brief Accessor interface for Editor part.
@@ -105,10 +106,12 @@ protected:
/**
* Constructor.
*
- * Create the Editor object with \p parent.
- * \param parent parent object
+ * Create the Editor object and pass it the internal
+ * implementation to store a d-pointer.
+ *
+ * @param impl d-pointer to use
*/
- Editor(QObject *parent);
+ Editor (EditorPrivate *impl);
/**
* Virtual destructor.
@@ -230,7 +233,10 @@ Q_SIGNALS:
KTextEditor::Document *document);
private:
- class EditorPrivate *const d;
+ /**
+ * private d-pointer, pointing to the internal implementation
+ */
+ EditorPrivate *const d;
};
}
diff --git a/src/mode/katemodeconfigpage.cpp b/src/mode/katemodeconfigpage.cpp
index f193913..94aad28 100644
--- a/src/mode/katemodeconfigpage.cpp
+++ b/src/mode/katemodeconfigpage.cpp
@@ -109,7 +109,7 @@ void ModeConfigPage::apply()
save();
- KateGlobal::self()->modeManager()->save(m_types);
+ KTextEditor::EditorPrivate::self()->modeManager()->save(m_types);
}
void ModeConfigPage::reload()
@@ -118,7 +118,7 @@ void ModeConfigPage::reload()
m_types.clear();
// deep copy...
- foreach (KateFileType *type, KateGlobal::self()->modeManager()->list()) {
+ foreach (KateFileType *type, KTextEditor::EditorPrivate::self()->modeManager()->list()) {
KateFileType *t = new KateFileType();
*t = *type;
m_types.append(t);
@@ -153,7 +153,7 @@ void ModeConfigPage::update()
// get current filetype from active view via the host application
int currentIndex = 0;
- KateView *kv = qobject_cast<KateView *>(KateGlobal::self()->application()->activeMainWindow()->activeView());
+ KateView *kv = qobject_cast<KateView *>(KTextEditor::EditorPrivate::self()->application()->activeMainWindow()->activeView());
if (kv) {
const QString filetypeName = kv->doc()->fileType();
for (int i = 0; i < m_types.size(); ++i) {
diff --git a/src/mode/katemodemenu.cpp b/src/mode/katemodemenu.cpp
index dfd7491..152b53d 100644
--- a/src/mode/katemodemenu.cpp
+++ b/src/mode/katemodemenu.cpp
@@ -70,12 +70,12 @@ void KateModeMenu::updateMenu(KTextEditor::Document *doc)
void KateModeMenu::slotAboutToShow()
{
KateDocument *doc = m_doc;
- int count = KateGlobal::self()->modeManager()->list().count();
+ int count = KTextEditor::EditorPrivate::self()->modeManager()->list().count();
for (int z = 0; z < count; z++) {
- QString nameRaw = KateGlobal::self()->modeManager()->list().at(z)->name;
- QString hlName = KateGlobal::self()->modeManager()->list().at(z)->nameTranslated();
- QString hlSection = KateGlobal::self()->modeManager()->list().at(z)->sectionTranslated();
+ QString nameRaw = KTextEditor::EditorPrivate::self()->modeManager()->list().at(z)->name;
+ QString hlName = KTextEditor::EditorPrivate::self()->modeManager()->list().at(z)->nameTranslated();
+ QString hlSection = KTextEditor::EditorPrivate::self()->modeManager()->list().at(z)->sectionTranslated();
if (!hlSection.isEmpty() && !names.contains(hlName)) {
if (!subMenusName.contains(hlSection)) {
@@ -129,7 +129,7 @@ void KateModeMenu::slotAboutToShow()
}
} else {
if (!doc->fileType().isEmpty()) {
- const KateFileType &t = KateGlobal::self()->modeManager()->fileType(doc->fileType());
+ const KateFileType &t = KTextEditor::EditorPrivate::self()->modeManager()->fileType(doc->fileType());
int i = subMenusName.indexOf(t.section);
if (i >= 0 && subMenus.at(i)) {
QList<QAction *> actions = subMenus.at(i)->actions();
diff --git a/src/printing/printconfigwidgets.cpp b/src/printing/printconfigwidgets.cpp
index ccb6107..4b85840 100644
--- a/src/printing/printconfigwidgets.cpp
+++ b/src/printing/printconfigwidgets.cpp
@@ -551,7 +551,7 @@ KatePrintLayout::KatePrintLayout(QWidget *parent)
sbBoxMargin->setValue(6);
gbBoxProps->setEnabled(false);
- Q_FOREACH (const KateSchema &schema, KateGlobal::self()->schemaManager()->list()) {
+ Q_FOREACH (const KateSchema &schema, KTextEditor::EditorPrivate::self()->schemaManager()->list()) {
cmbSchema->addItem(schema.translatedName(), QVariant(schema.rawName));
}
diff --git a/src/schema/kateschema.cpp b/src/schema/kateschema.cpp
index e41b3f9..a91b386 100644
--- a/src/schema/kateschema.cpp
+++ b/src/schema/kateschema.cpp
@@ -95,7 +95,7 @@ void KateViewSchemaAction::slotAboutToShow()
{
KateView *view = m_view;
- QList<KateSchema> schemas = KateGlobal::self()->schemaManager()->list();
+ QList<KateSchema> schemas = KTextEditor::EditorPrivate::self()->schemaManager()->list();
if (!m_group) {
m_group = new QActionGroup(menu());
diff --git a/src/schema/kateschemaconfig.cpp b/src/schema/kateschemaconfig.cpp
index 03d186e..14cb8ca 100644
--- a/src/schema/kateschemaconfig.cpp
+++ b/src/schema/kateschemaconfig.cpp
@@ -290,7 +290,7 @@ void KateSchemaConfigColorTab::schemaChanged(const QString &newSchema)
// If we havent this schema, read in from config file
if (! m_schemas.contains(newSchema)) {
- KConfigGroup config = KateGlobal::self()->schemaManager()->schema(newSchema);
+ KConfigGroup config = KTextEditor::EditorPrivate::self()->schemaManager()->schema(newSchema);
QVector<KateColorItem> items = readConfig(config);
m_schemas[ newSchema ] = items;
@@ -352,7 +352,7 @@ void KateSchemaConfigColorTab::apply()
schemaChanged(m_currentSchema);
QMap<QString, QVector<KateColorItem> >::Iterator it;
for (it = m_schemas.begin(); it != m_schemas.end(); ++it) {
- KConfigGroup config = KateGlobal::self()->schemaManager()->schema(it.key());
+ KConfigGroup config = KTextEditor::EditorPrivate::self()->schemaManager()->schema(it.key());
qCDebug(LOG_PART) << "writing 'Color' tab: scheme =" << it.key()
<< "and config group =" << config.name();
@@ -379,7 +379,7 @@ void KateSchemaConfigColorTab::reload()
m_schemas.clear();
// load from config
- KConfigGroup config = KateGlobal::self()->schemaManager()->schema(m_currentSchema);
+ KConfigGroup config = KTextEditor::EditorPrivate::self()->schemaManager()->schema(m_currentSchema);
QVector<KateColorItem> items = readConfig(config);
// first block signals otherwise setColor emits changed
@@ -427,7 +427,7 @@ void KateSchemaConfigFontTab::apply()
{
QMap<QString, QFont>::Iterator it;
for (it = m_fonts.begin(); it != m_fonts.end(); ++it) {
- KateGlobal::self()->schemaManager()->schema(it.key()).writeEntry("Font", it.value());
+ KTextEditor::EditorPrivate::self()->schemaManager()->schema(it.key()).writeEntry("Font", it.value());
}
// all fonts are written, so throw away all cached schemas
@@ -452,7 +452,7 @@ void KateSchemaConfigFontTab::schemaChanged(const QString &newSchema)
if (m_fonts.contains(m_currentSchema)) {
newFont = m_fonts[m_currentSchema];
} else {
- newFont = KateGlobal::self()->schemaManager()->schema(m_currentSchema).readEntry("Font", newFont);
+ newFont = KTextEditor::EditorPrivate::self()->schemaManager()->schema(m_currentSchema).readEntry("Font", newFont);
}
m_fontchooser->disconnect(this);
@@ -624,7 +624,7 @@ KateSchemaConfigHighlightTab::KateSchemaConfigHighlightTab(KateSchemaConfigDefau
// get current highlighting from the host application
int hl = 0;
- KateView *kv = qobject_cast<KateView *>(KateGlobal::self()->application()->activeMainWindow()->activeView());
+ KateView *kv = qobject_cast<KateView *>(KTextEditor::EditorPrivate::self()->application()->activeMainWindow()->activeView());
if (kv) {
const QString hlName = kv->doc()->highlight()->name();
hl = KateHlManager::self()->nameFind(hlName);
@@ -1051,7 +1051,7 @@ QString KateSchemaConfigPage::requestSchemaName(const QString &suggestedName)
//
// if schema exists, prepare option to replace
- if (KateGlobal::self()->schemaManager()->schema(schemaName).exists()) {
+ if (KTextEditor::EditorPrivate::self()->schemaManager()->schema(schemaName).exists()) {
howToImport.radioReplaceExisting->show();
howToImport.radioReplaceExisting->setText(i18n("Replace existing schema %1", schemaName));
howToImport.radioReplaceExisting->setChecked(true);
@@ -1079,7 +1079,7 @@ QString KateSchemaConfigPage::requestSchemaName(const QString &suggestedName)
// new one, check again, whether the schema already exists
else if (howToImport.radioAsNew->isChecked()) {
schemaName = howToImport.newName->text();
- if (KateGlobal::self()->schemaManager()->schema(schemaName).exists()) {
+ if (KTextEditor::EditorPrivate::self()->schemaManager()->schema(schemaName).exists()) {
reask = true;
} else {
reask = false;
@@ -1194,8 +1194,8 @@ void KateSchemaConfigPage::apply()
m_highlightTab->apply();
// just sync the config and reload
- KateGlobal::self()->schemaManager()->config().sync();
- KateGlobal::self()->schemaManager()->config().reparseConfiguration();
+ KTextEditor::EditorPrivate::self()->schemaManager()->config().sync();
+ KTextEditor::EditorPrivate::self()->schemaManager()->config().reparseConfiguration();
// clear all attributes
for (int i = 0; i < KateHlManager::self()->highlights(); ++i) {
@@ -1218,7 +1218,7 @@ void KateSchemaConfigPage::apply()
void KateSchemaConfigPage::reload()
{
// now reload the config from disc
- KateGlobal::self()->schemaManager()->config().reparseConfiguration();
+ KTextEditor::EditorPrivate::self()->schemaManager()->config().reparseConfiguration();
// reinitialize combo boxes
refillCombos(KateRendererConfig::global()->schema(), KateRendererConfig::global()->schema());
@@ -1242,7 +1242,7 @@ void KateSchemaConfigPage::refillCombos(const QString &schemaName, const QString
// reinitialize combo boxes
schemaCombo->clear();
defaultSchemaCombo->clear();
- QList<KateSchema> schemaList = KateGlobal::self()->schemaManager()->list();
+ QList<KateSchema> schemaList = KTextEditor::EditorPrivate::self()->schemaManager()->list();
foreach (const KateSchema &s, schemaList) {
schemaCombo->addItem(s.translatedName(), s.rawName);
defaultSchemaCombo->addItem(s.translatedName(), s.rawName);
@@ -1284,14 +1284,14 @@ void KateSchemaConfigPage::deleteSchema()
const int comboIndex = schemaCombo->currentIndex();
const QString schemaNameToDelete = schemaCombo->itemData(comboIndex).toString();
- if (KateGlobal::self()->schemaManager()->schemaData(schemaNameToDelete).shippedDefaultSchema) {
+ if (KTextEditor::EditorPrivate::self()->schemaManager()->schemaData(schemaNameToDelete).shippedDefaultSchema) {
// Default and Printing schema cannot be deleted.
qCDebug(LOG_PART) << "default and printing schema cannot be deleted";
return;
}
// kill group
- KateGlobal::self()->schemaManager()->config().deleteGroup(schemaNameToDelete);
+ KTextEditor::EditorPrivate::self()->schemaManager()->config().deleteGroup(schemaNameToDelete);
// fallback to Default schema
schemaCombo->setCurrentIndex(schemaCombo->findData(QVariant(QString::fromLatin1("Normal"))));
@@ -1317,7 +1317,7 @@ bool KateSchemaConfigPage::newSchema(const QString &newName)
}
// try if schema already around
- if (KateGlobal::self()->schemaManager()->schema(schemaName).exists()) {
+ if (KTextEditor::EditorPrivate::self()->schemaManager()->schema(schemaName).exists()) {
KMessageBox::information(this, i18n("<p>The schema %1 already exists.</p><p>Please choose a different schema name.</p>", schemaName), i18n("New Schema"));
return false;
}
@@ -1334,7 +1334,7 @@ bool KateSchemaConfigPage::newSchema(const QString &newName)
void KateSchemaConfigPage::schemaChanged(const QString &schema)
{
- btndel->setEnabled(!KateGlobal::self()->schemaManager()->schemaData(schema).shippedDefaultSchema);
+ btndel->setEnabled(!KTextEditor::EditorPrivate::self()->schemaManager()->schemaData(schema).shippedDefaultSchema);
// propagate changed schema to all tabs
m_colorTab->schemaChanged(schema);
diff --git a/src/script/katescriptaction.cpp b/src/script/katescriptaction.cpp
index 7af6451..afe317e 100644
--- a/src/script/katescriptaction.cpp
+++ b/src/script/katescriptaction.cpp
@@ -72,7 +72,7 @@ KateScriptActionMenu::KateScriptActionMenu(KateView *view, const QString &text)
repopulate();
// on script-reload signal, repopulate script menu
- connect(KateGlobal::self()->scriptManager(), SIGNAL(reloaded()),
+ connect(KTextEditor::EditorPrivate::self()->scriptManager(), SIGNAL(reloaded()),
this, SLOT(repopulate()));
}
@@ -105,7 +105,7 @@ void KateScriptActionMenu::repopulate()
// now add all command line script commands
QVector<KateCommandLineScript *> scripts =
- KateGlobal::self()->scriptManager()->commandLineScripts();
+ KTextEditor::EditorPrivate::self()->scriptManager()->commandLineScripts();
QHash<QString, QMenu *> menus;
diff --git a/src/spellcheck/ontheflycheck.cpp b/src/spellcheck/ontheflycheck.cpp
index dcea059..cfcace5 100644
--- a/src/spellcheck/ontheflycheck.cpp
+++ b/src/spellcheck/ontheflycheck.cpp
@@ -761,7 +761,7 @@ void KateOnTheFlyChecker::queueSpellCheckVisibleRange(KateView *view, const KTex
deleteMovingRanges(highlightsList);
QList<QPair<KTextEditor::Range, QString> > spellCheckRanges
- = KateGlobal::self()->spellCheckManager()->spellCheckRanges(m_document,
+ = KTextEditor::EditorPrivate::self()->spellCheckManager()->spellCheckRanges(m_document,
intersection,
true);
//we queue them up in reverse
@@ -783,7 +783,7 @@ void KateOnTheFlyChecker::queueLineSpellCheck(KateDocument *kateDocument, int li
deleteMovingRanges(highlightsList);
QList<QPair<KTextEditor::Range, QString> > spellCheckRanges
- = KateGlobal::self()->spellCheckManager()->spellCheckRanges(kateDocument,
+ = KTextEditor::EditorPrivate::self()->spellCheckManager()->spellCheckRanges(kateDocument,
range,
true);
//we queue them up in reverse
diff --git a/src/spellcheck/spellcheckdialog.cpp b/src/spellcheck/spellcheckdialog.cpp
index e745df7..a8dd14f 100644
--- a/src/spellcheck/spellcheckdialog.cpp
+++ b/src/spellcheck/spellcheckdialog.cpp
@@ -191,7 +191,7 @@ void KateSpellCheckDialog::corrected(const QString &word, int pos, const QString
KTextEditor::Cursor replacementStartCursor = locatePosition(origPos);
KTextEditor::Range replacementRange = KTextEditor::Range(replacementStartCursor, length);
KateDocument *doc = m_view->doc();
- KateGlobal::self()->spellCheckManager()->replaceCharactersEncodedIfNecessary(newWord, doc, replacementRange);
+ KTextEditor::EditorPrivate::self()->spellCheckManager()->replaceCharactersEncodedIfNecessary(newWord, doc, replacementRange);
m_currentSpellCheckRange.setRange(KTextEditor::Range(replacementStartCursor, m_currentSpellCheckRange.end()));
// we have to be careful here: due to static word wrapping the text might change in addition to simply
@@ -206,7 +206,7 @@ void KateSpellCheckDialog::performSpellCheck(const KTextEditor::Range &range)
if (range.isEmpty()) {
spellCheckDone();
}
- m_languagesInSpellCheckRange = KateGlobal::self()->spellCheckManager()->spellCheckLanguageRanges(m_view->doc(), range);
+ m_languagesInSpellCheckRange = KTextEditor::EditorPrivate::self()->spellCheckManager()->spellCheckLanguageRanges(m_view->doc(), range);
m_currentLanguageRangeIterator = m_languagesInSpellCheckRange.begin();
m_currentSpellCheckRange = KTextEditor::Range::invalid();
installNextSpellCheckRange();
@@ -223,7 +223,7 @@ void KateSpellCheckDialog::installNextSpellCheckRange()
spellCheckDone();
return;
}
- KateSpellCheckManager *spellCheckManager = KateGlobal::self()->spellCheckManager();
+ KateSpellCheckManager *spellCheckManager = KTextEditor::EditorPrivate::self()->spellCheckManager();
KTextEditor::Cursor nextRangeBegin = (m_currentSpellCheckRange.isValid() ? m_currentSpellCheckRange.end()
: KTextEditor::Cursor::invalid());
m_currentSpellCheckRange = KTextEditor::Range::invalid();
diff --git a/src/spellcheck/spellingmenu.cpp b/src/spellcheck/spellingmenu.cpp
index 10c08a0..0957ebc 100644
--- a/src/spellcheck/spellingmenu.cpp
+++ b/src/spellcheck/spellingmenu.cpp
@@ -183,7 +183,7 @@ void KateSpellingMenu::populateSuggestionsMenu()
m_spellingMenu->addSeparator();
const QString &misspelledWord = m_view->doc()->text(*m_currentMisspelledRange);
const QString dictionary = m_view->doc()->dictionaryForMisspelledRange(*m_currentMisspelledRange);
- m_currentSuggestions = KateGlobal::self()->spellCheckManager()->suggestions(misspelledWord, dictionary);
+ m_currentSuggestions = KTextEditor::EditorPrivate::self()->spellCheckManager()->suggestions(misspelledWord, dictionary);
int counter = 0;
for (QStringList::iterator i = m_currentSuggestions.begin(); i != m_currentSuggestions.end() && counter < 10; ++i) {
@@ -199,7 +199,7 @@ void KateSpellingMenu::populateSuggestionsMenu()
void KateSpellingMenu::replaceWordBySuggestion(const QString &suggestion)
{
KateDocument *doc = m_view->doc();
- KateGlobal::self()->spellCheckManager()->replaceCharactersEncodedIfNecessary(suggestion, doc, *m_currentMisspelledRange);
+ KTextEditor::EditorPrivate::self()->spellCheckManager()->replaceCharactersEncodedIfNecessary(suggestion, doc, *m_currentMisspelledRange);
}
void KateSpellingMenu::addCurrentWordToDictionary()
@@ -209,7 +209,7 @@ void KateSpellingMenu::addCurrentWordToDictionary()
}
const QString &misspelledWord = m_view->doc()->text(*m_currentMisspelledRange);
const QString dictionary = m_view->doc()->dictionaryForMisspelledRange(*m_currentMisspelledRange);
- KateGlobal::self()->spellCheckManager()->addToDictionary(misspelledWord, dictionary);
+ KTextEditor::EditorPrivate::self()->spellCheckManager()->addToDictionary(misspelledWord, dictionary);
m_view->doc()->clearMisspellingForWord(misspelledWord); // WARNING: 'm_currentMisspelledRange' is deleted here!
}
@@ -220,7 +220,7 @@ void KateSpellingMenu::ignoreCurrentWord()
}
const QString &misspelledWord = m_view->doc()->text(*m_currentMisspelledRange);
const QString dictionary = m_view->doc()->dictionaryForMisspelledRange(*m_currentMisspelledRange);
- KateGlobal::self()->spellCheckManager()->ignoreWord(misspelledWord, dictionary);
+ KTextEditor::EditorPrivate::self()->spellCheckManager()->ignoreWord(misspelledWord, dictionary);
m_view->doc()->clearMisspellingForWord(misspelledWord); // WARNING: 'm_currentMisspelledRange' is deleted here!
}
diff --git a/src/src/ktexteditor.cpp b/src/src/ktexteditor.cpp
index 0cf0557..e72e4e2 100644
--- a/src/src/ktexteditor.cpp
+++ b/src/src/ktexteditor.cpp
@@ -48,9 +48,9 @@
using namespace KTextEditor;
-Editor::Editor(QObject *parent)
- : QObject(parent)
- , d(nullptr)
+Editor::Editor(EditorPrivate *impl)
+ : QObject ()
+ , d (impl)
{
}
@@ -61,9 +61,9 @@ Editor::~Editor()
Editor *KTextEditor::Editor::instance()
{
/**
- * Just use internal KateGlobal::self()
+ * Just use internal KTextEditor::EditorPrivate::self()
*/
- return KateGlobal::self();
+ return KTextEditor::EditorPrivate::self();
}
QString Editor::defaultEncoding () const
@@ -71,7 +71,7 @@ QString Editor::defaultEncoding () const
/**
* return default encoding in global config object
*/
- return KateGlobal::self()->documentConfig()->encoding ();
+ return d->documentConfig()->encoding ();
}
bool View::insertText(const QString &text)
diff --git a/src/syntax/katesyntaxmanager.cpp b/src/syntax/katesyntaxmanager.cpp
index 8fb8d6b..270bd7c 100644
--- a/src/syntax/katesyntaxmanager.cpp
+++ b/src/syntax/katesyntaxmanager.cpp
@@ -94,7 +94,7 @@ KateHlManager::~KateHlManager()
KateHlManager *KateHlManager::self()
{
- return KateGlobal::self()->hlManager();
+ return KTextEditor::EditorPrivate::self()->hlManager();
}
KateHighlighting *KateHlManager::getHl(int n)
diff --git a/src/utils/kateautoindent.cpp b/src/utils/kateautoindent.cpp
index bf76ca2..46b3789 100644
--- a/src/utils/kateautoindent.cpp
+++ b/src/utils/kateautoindent.cpp
@@ -65,7 +65,7 @@ QStringList KateAutoIndent::listIdentifiers()
int KateAutoIndent::modeCount()
{
// inbuild modes + scripts
- return 2 + KateGlobal::self()->scriptManager()->indentationScriptCount();
+ return 2 + KTextEditor::EditorPrivate::self()->scriptManager()->indentationScriptCount();
}
QString KateAutoIndent::modeName(int mode)
@@ -78,7 +78,7 @@ QString KateAutoIndent::modeName(int mode)
return MODE_NORMAL;
}
- return KateGlobal::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().baseName();
+ return KTextEditor::EditorPrivate::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().baseName();
}
QString KateAutoIndent::modeDescription(int mode)
@@ -91,7 +91,7 @@ QString KateAutoIndent::modeDescription(int mode)
return i18nc("Autoindent mode", "Normal");
}
- const QString &name = KateGlobal::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().name();
+ const QString &name = KTextEditor::EditorPrivate::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().name();
return i18nc("Autoindent mode", name.toUtf8().constData());
}
@@ -101,7 +101,7 @@ QString KateAutoIndent::modeRequiredStyle(int mode)
return QString();
}
- return KateGlobal::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().requiredStyle();
+ return KTextEditor::EditorPrivate::self()->scriptManager()->indentationScriptByIndex(mode - 2)->indentHeader().requiredStyle();
}
uint KateAutoIndent::modeNumber(const QString &name)
@@ -120,7 +120,7 @@ KateAutoIndent::KateAutoIndent(KateDocument *_doc)
// don't call updateConfig() here, document might is not ready for that....
// on script reload, the script pointer is invalid -> force reload
- connect(KateGlobal::self()->scriptManager(), SIGNAL(reloaded()),
+ connect(KTextEditor::EditorPrivate::self()->scriptManager(), SIGNAL(reloaded()),
this, SLOT(reloadScript()));
}
@@ -330,7 +330,7 @@ void KateAutoIndent::setMode(const QString &name)
}
// handle script indenters, if any for this name...
- KateIndentScript *script = KateGlobal::self()->scriptManager()->indentationScript(name);
+ KateIndentScript *script = KTextEditor::EditorPrivate::self()->scriptManager()->indentationScript(name);
if (script) {
if (isStyleProvided(script, doc->highlight())) {
m_script = script;
diff --git a/src/utils/katecmd.cpp b/src/utils/katecmd.cpp
index 2a411c0..481e10d 100644
--- a/src/utils/katecmd.cpp
+++ b/src/utils/katecmd.cpp
@@ -114,7 +114,7 @@ QStringList KateCmd::commandList() const
KateCmd *KateCmd::self()
{
- return KateGlobal::self()->cmdManager();
+ return KTextEditor::EditorPrivate::self()->cmdManager();
}
void KateCmd::appendHistory(const QString &cmd)
diff --git a/src/utils/katecmds.cpp b/src/utils/katecmds.cpp
index d219aaf..930ce39 100644
--- a/src/utils/katecmds.cpp
+++ b/src/utils/katecmds.cpp
@@ -554,7 +554,7 @@ bool KateCommands::ViCommands::exec(KTextEditor::View *view,
if (mappingCommands().contains(cmd)) {
if (cmd.endsWith(QLatin1String("unmap"))) {
if (args.count() == 1) {
- KateGlobal::self()->viInputModeGlobal()->removeMapping(modeForMapCommand(cmd), args.at(0));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->removeMapping(modeForMapCommand(cmd), args.at(0));
return true;
} else {
msg = i18n("Missing argument. Usage: %1 <from>", cmd);
@@ -562,7 +562,7 @@ bool KateCommands::ViCommands::exec(KTextEditor::View *view,
}
}
if (args.count() == 1) {
- msg = KateGlobal::self()->viInputModeGlobal()->getMapping(modeForMapCommand(cmd), args.at(0), true);
+ msg = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMapping(modeForMapCommand(cmd), args.at(0), true);
if (msg.isEmpty()) {
msg = i18n("No mapping found for \"%1\"", args.at(0));
return false;
@@ -571,7 +571,7 @@ bool KateCommands::ViCommands::exec(KTextEditor::View *view,
}
} else if (args.count() == 2) {
KateViGlobal::MappingRecursion mappingRecursion = (isMapCommandRecursive(cmd)) ? KateViGlobal::Recursive : KateViGlobal::NonRecursive;
- KateGlobal::self()->viInputModeGlobal()->addMapping(modeForMapCommand(cmd), args.at(0), args.at(1), mappingRecursion);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->addMapping(modeForMapCommand(cmd), args.at(0), args.at(1), mappingRecursion);
} else {
msg = i18n("Missing argument(s). Usage: %1 <from> [<to>]", cmd);
return false;
@@ -687,7 +687,7 @@ KCompletion *KateCommands::ViCommands::completionObject(KTextEditor::View *view,
KateView *v = static_cast<KateView *>(view);
if (v && (cmd == QLatin1String("nn") || cmd == QLatin1String("nnoremap"))) {
- QStringList l = KateGlobal::self()->viInputModeGlobal()->getMappings(KateViGlobal::NormalModeMapping);
+ QStringList l = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMappings(KateViGlobal::NormalModeMapping);
KateCmdShellCompletion *co = new KateCmdShellCompletion();
co->setItems(l);
diff --git a/src/utils/kateconfig.cpp b/src/utils/kateconfig.cpp
index b13cf39..d209948 100644
--- a/src/utils/kateconfig.cpp
+++ b/src/utils/kateconfig.cpp
@@ -437,8 +437,8 @@ void KateDocumentConfig::updateConfig()
}
if (isGlobal()) {
- for (int z = 0; z < KateGlobal::self()->kateDocuments().size(); ++z) {
- (KateGlobal::self()->kateDocuments())[z]->updateConfig();
+ for (int z = 0; z < KTextEditor::EditorPrivate::self()->kateDocuments().size(); ++z) {
+ (KTextEditor::EditorPrivate::self()->kateDocuments())[z]->updateConfig();
}
}
}
@@ -1458,8 +1458,8 @@ void KateViewConfig::updateConfig()
}
if (isGlobal()) {
- for (int z = 0; z < KateGlobal::self()->views().size(); ++z) {
- (KateGlobal::self()->views())[z]->updateConfig();
+ for (int z = 0; z < KTextEditor::EditorPrivate::self()->views().size(); ++z) {
+ (KTextEditor::EditorPrivate::self()->views())[z]->updateConfig();
}
}
}
@@ -2204,8 +2204,8 @@ void KateRendererConfig::updateConfig()
}
if (isGlobal()) {
- for (int z = 0; z < KateGlobal::self()->views().size(); ++z) {
- (KateGlobal::self()->views())[z]->renderer()->updateConfig();
+ for (int z = 0; z < KTextEditor::EditorPrivate::self()->views().size(); ++z) {
+ (KTextEditor::EditorPrivate::self()->views())[z]->renderer()->updateConfig();
}
}
}
@@ -2236,7 +2236,7 @@ void KateRendererConfig::reloadSchema()
{
if (isGlobal()) {
setSchemaInternal(m_schema);
- foreach (KateView *view, KateGlobal::self()->views()) {
+ foreach (KateView *view, KTextEditor::EditorPrivate::self()->views()) {
view->renderer()->config()->reloadSchema();
}
}
@@ -2251,7 +2251,7 @@ void KateRendererConfig::setSchemaInternal(const QString &schema)
m_schemaSet = true;
m_schema = schema;
- KConfigGroup config = KateGlobal::self()->schemaManager()->schema(schema);
+ KConfigGroup config = KTextEditor::EditorPrivate::self()->schemaManager()->schema(schema);
// NOTE keep in sync with KateSchemaConfigColorTab::schemaChanged
KColorScheme schemeView(QPalette::Active, KColorScheme::View);
diff --git a/src/utils/kateconfig.h b/src/utils/kateconfig.h
index 59841f0..b9610d7 100644
--- a/src/utils/kateconfig.h
+++ b/src/utils/kateconfig.h
@@ -37,6 +37,10 @@ class KateView;
class KateDocument;
class KateRenderer;
+namespace KTextEditor {
+ class EditorPrivate;
+}
+
class KConfig;
class QTextCodec;
@@ -93,10 +97,10 @@ private:
class KTEXTEDITOR_EXPORT KateGlobalConfig : public KateConfig
{
private:
- friend class KateGlobal;
+ friend class KTextEditor::EditorPrivate;
/**
- * only used in KateGlobal for the static global fallback !!!
+ * only used in KTextEditor::EditorPrivate for the static global fallback !!!
*/
KateGlobalConfig();
@@ -148,7 +152,7 @@ private:
class KTEXTEDITOR_EXPORT KateDocumentConfig : public KateConfig
{
private:
- friend class KateGlobal;
+ friend class KTextEditor::EditorPrivate;
KateDocumentConfig();
@@ -398,10 +402,10 @@ private:
class KTEXTEDITOR_EXPORT KateViewConfig : public KateConfig
{
private:
- friend class KateGlobal;
+ friend class KTextEditor::EditorPrivate;
/**
- * only used in KateGlobal for the static global fallback !!!
+ * only used in KTextEditor::EditorPrivate for the static global fallback !!!
*/
KateViewConfig();
@@ -620,10 +624,10 @@ private:
class KTEXTEDITOR_EXPORT KateRendererConfig : public KateConfig
{
private:
- friend class KateGlobal;
+ friend class KTextEditor::EditorPrivate;
/**
- * only used in KateGlobal for the static global fallback !!!
+ * only used in KTextEditor::EditorPrivate for the static global fallback !!!
*/
KateRendererConfig();
diff --git a/src/utils/kateglobal.cpp b/src/utils/kateglobal.cpp
index 837ce61..4f25775 100644
--- a/src/utils/kateglobal.cpp
+++ b/src/utils/kateglobal.cpp
@@ -56,19 +56,19 @@ Q_LOGGING_CATEGORY(LOG_PART, "katepart")
//BEGIN unit test mode
static bool kateUnitTestMode = false;
-void KateGlobal::enableUnitTestMode()
+void KTextEditor::EditorPrivate::enableUnitTestMode()
{
kateUnitTestMode = true;
}
-bool KateGlobal::unitTestMode()
+bool KTextEditor::EditorPrivate::unitTestMode()
{
return kateUnitTestMode;
}
//END unit test mode
-KateGlobal::KateGlobal(QPointer<KateGlobal> &staticInstance)
- : KTextEditor::Editor(0)
+KTextEditor::EditorPrivate::EditorPrivate(QPointer<KTextEditor::EditorPrivate> &staticInstance)
+ : KTextEditor::Editor (this)
, m_aboutData(QLatin1String("katepart"), QString(), i18n("Kate Part"), QLatin1String(KTEXTEDITOR_VERSION_STRING),
i18n("Embeddable editor component"), KAboutData::License_LGPL_V2,
i18n("(c) 2000-2014 The Kate Authors"), QString(), QLatin1String("http://kate-editor.org"))
@@ -211,7 +211,7 @@ KateGlobal::KateGlobal(QPointer<KateGlobal> &staticInstance)
qRegisterMetaType<KSharedConfig::Ptr>("KSharedConfig::Ptr");
}
-KateGlobal::~KateGlobal()
+KTextEditor::EditorPrivate::~EditorPrivate()
{
delete m_globalConfig;
delete m_documentConfig;
@@ -239,7 +239,7 @@ KateGlobal::~KateGlobal()
delete m_wordCompletionModel;
}
-KTextEditor::Document *KateGlobal::createDocument(QObject *parent)
+KTextEditor::Document *KTextEditor::EditorPrivate::createDocument(QObject *parent)
{
KateDocument *doc = new KateDocument(false, false, 0, parent);
@@ -248,13 +248,13 @@ KTextEditor::Document *KateGlobal::createDocument(QObject *parent)
return doc;
}
-const QList<KTextEditor::Document *> &KateGlobal::documents()
+const QList<KTextEditor::Document *> &KTextEditor::EditorPrivate::documents()
{
return m_docs;
}
//BEGIN KTextEditor::Editor config stuff
-void KateGlobal::readConfig(KConfig *config)
+void KTextEditor::EditorPrivate::readConfig(KConfig *config)
{
if (!config) {
config = KSharedConfig::openConfig().data();
@@ -271,7 +271,7 @@ void KateGlobal::readConfig(KConfig *config)
m_viInputModeGlobal->readConfig(KConfigGroup(config, "Kate Vi Input Mode Settings"));
}
-void KateGlobal::writeConfig(KConfig *config)
+void KTextEditor::EditorPrivate::writeConfig(KConfig *config)
{
if (!config) {
config = KSharedConfig::openConfig().data();
@@ -296,7 +296,7 @@ void KateGlobal::writeConfig(KConfig *config)
}
//END KTextEditor::Editor config stuff
-void KateGlobal::configDialog(QWidget *parent)
+void KTextEditor::EditorPrivate::configDialog(QWidget *parent)
{
QPointer<KPageDialog> kd = new KPageDialog(parent);
@@ -343,12 +343,12 @@ void KateGlobal::configDialog(QWidget *parent)
delete kd;
}
-int KateGlobal::configPages() const
+int KTextEditor::EditorPrivate::configPages() const
{
return 4;
}
-KTextEditor::ConfigPage *KateGlobal::configPage(int number, QWidget *parent)
+KTextEditor::ConfigPage *KTextEditor::EditorPrivate::configPage(int number, QWidget *parent)
{
switch (number) {
case 0:
@@ -370,7 +370,7 @@ KTextEditor::ConfigPage *KateGlobal::configPage(int number, QWidget *parent)
return 0;
}
-QString KateGlobal::configPageName(int number) const
+QString KTextEditor::EditorPrivate::configPageName(int number) const
{
switch (number) {
case 0:
@@ -392,7 +392,7 @@ QString KateGlobal::configPageName(int number) const
return QString();
}
-QString KateGlobal::configPageFullName(int number) const
+QString KTextEditor::EditorPrivate::configPageFullName(int number) const
{
switch (number) {
case 0:
@@ -414,7 +414,7 @@ QString KateGlobal::configPageFullName(int number) const
return QString();
}
-QIcon KateGlobal::configPageIcon(int number) const
+QIcon KTextEditor::EditorPrivate::configPageIcon(int number) const
{
switch (number) {
case 0:
@@ -437,23 +437,23 @@ QIcon KateGlobal::configPageIcon(int number) const
}
/**
- * Cleanup the KateGlobal during QCoreApplication shutdown
+ * Cleanup the KTextEditor::EditorPrivate during QCoreApplication shutdown
*/
static void cleanupGlobal()
{
/**
* delete if there
*/
- delete KateGlobal::self();
+ delete KTextEditor::EditorPrivate::self();
}
-KateGlobal *KateGlobal::self()
+KTextEditor::EditorPrivate *KTextEditor::EditorPrivate::self()
{
/**
* remember the static instance in a QPointer
*/
static bool inited = false;
- static QPointer<KateGlobal> staticInstance;
+ static QPointer<KTextEditor::EditorPrivate> staticInstance;
/**
* just return it, if already inited
@@ -470,7 +470,7 @@ KateGlobal *KateGlobal::self()
/**
* now create the object and store it
*/
- new KateGlobal(staticInstance);
+ new KTextEditor::EditorPrivate(staticInstance);
/**
* register cleanup
@@ -484,66 +484,66 @@ KateGlobal *KateGlobal::self()
return staticInstance.data();
}
-void KateGlobal::registerDocument(KateDocument *doc)
+void KTextEditor::EditorPrivate::registerDocument(KateDocument *doc)
{
m_documents.append(doc);
m_docs.append(doc);
}
-void KateGlobal::deregisterDocument(KateDocument *doc)
+void KTextEditor::EditorPrivate::deregisterDocument(KateDocument *doc)
{
m_docs.removeAll(doc);
m_documents.removeAll(doc);
}
-void KateGlobal::registerView(KateView *view)
+void KTextEditor::EditorPrivate::registerView(KateView *view)
{
m_views.append(view);
}
-void KateGlobal::deregisterView(KateView *view)
+void KTextEditor::EditorPrivate::deregisterView(KateView *view)
{
m_views.removeAll(view);
}
//BEGIN command interface
-bool KateGlobal::registerCommand(KTextEditor::Command *cmd)
+bool KTextEditor::EditorPrivate::registerCommand(KTextEditor::Command *cmd)
{
return m_cmdManager->registerCommand(cmd);
}
-bool KateGlobal::unregisterCommand(KTextEditor::Command *cmd)
+bool KTextEditor::EditorPrivate::unregisterCommand(KTextEditor::Command *cmd)
{
return m_cmdManager->unregisterCommand(cmd);
}
-KTextEditor::Command *KateGlobal::queryCommand(const QString &cmd) const
+KTextEditor::Command *KTextEditor::EditorPrivate::queryCommand(const QString &cmd) const
{
return m_cmdManager->queryCommand(cmd);
}
-QList<KTextEditor::Command *> KateGlobal::commands() const
+QList<KTextEditor::Command *> KTextEditor::EditorPrivate::commands() const
{
return m_cmdManager->commands();
}
-QStringList KateGlobal::commandList() const
+QStringList KTextEditor::EditorPrivate::commandList() const
{
return m_cmdManager->commandList();
}
//END command interface
-KTextEditor::TemplateScript *KateGlobal::registerTemplateScript(QObject *owner, const QString &script)
+KTextEditor::TemplateScript *KTextEditor::EditorPrivate::registerTemplateScript(QObject *owner, const QString &script)
{
return scriptManager()->registerTemplateScript(owner, script);
}
-void KateGlobal::unregisterTemplateScript(KTextEditor::TemplateScript *templateScript)
+void KTextEditor::EditorPrivate::unregisterTemplateScript(KTextEditor::TemplateScript *templateScript)
{
scriptManager()->unregisterTemplateScript(templateScript);
}
-void KateGlobal::updateColorPalette()
+void KTextEditor::EditorPrivate::updateColorPalette()
{
// reload the global schema (triggers reload for every view as well)
m_rendererConfig->reloadSchema();
@@ -552,7 +552,7 @@ void KateGlobal::updateColorPalette()
m_rendererConfig->updateConfig();
}
-void KateGlobal::copyToClipboard(const QString &text)
+void KTextEditor::EditorPrivate::copyToClipboard(const QString &text)
{
/**
* empty => nop
@@ -581,7 +581,7 @@ void KateGlobal::copyToClipboard(const QString &text)
emit clipboardHistoryChanged();
}
-bool KateGlobal::eventFilter(QObject *obj, QEvent *event)
+bool KTextEditor::EditorPrivate::eventFilter(QObject *obj, QEvent *event)
{
Q_UNUSED(obj);
diff --git a/src/utils/kateglobal.h b/src/utils/kateglobal.h
index 9c17930..cb98b8a 100644
--- a/src/utils/kateglobal.h
+++ b/src/utils/kateglobal.h
@@ -54,14 +54,17 @@ class KateWordCompletionModel;
Q_DECLARE_METATYPE(KSharedConfig::Ptr)
+namespace KTextEditor
+{
+
/**
- * KateGlobal
+ * KTextEditor::EditorPrivate
* One instance of this class is hold alive during
* a kate part session, as long as any factory, document
* or view stay around, here is the place to put things
* which are needed and shared by all this objects ;)
*/
-class KTEXTEDITOR_EXPORT KateGlobal : public KTextEditor::Editor, public KTextEditor::CommandInterface, public KTextEditor::TemplateScriptRegistrar
+class KTEXTEDITOR_EXPORT EditorPrivate : public KTextEditor::Editor, public KTextEditor::CommandInterface, public KTextEditor::TemplateScriptRegistrar
{
Q_OBJECT
Q_INTERFACES(KTextEditor::CommandInterface)
@@ -115,13 +118,13 @@ private:
* Default constructor, private, as singleton
* @param staticInstance pointer to fill with content of this
*/
- KateGlobal(QPointer<KateGlobal> &staticInstance);
+ EditorPrivate(QPointer<KTextEditor::EditorPrivate> &staticInstance);
public:
/**
* Destructor
*/
- ~KateGlobal();
+ ~EditorPrivate();
/**
* Create a new document object
@@ -221,7 +224,7 @@ public:
* singleton accessor
* @return instance of the factory
*/
- static KateGlobal *self();
+ static KTextEditor::EditorPrivate *self();
/**
* register document at the factory
@@ -547,5 +550,7 @@ private:
QPointer<KTextEditor::Application> m_application;
};
+}
+
#endif
diff --git a/src/utils/katetemplatehandler.cpp b/src/utils/katetemplatehandler.cpp
index 90d9653..6d262f3 100644
--- a/src/utils/katetemplatehandler.cpp
+++ b/src/utils/katetemplatehandler.cpp
@@ -1105,7 +1105,7 @@ QString KateTemplateHandler::MirrorBehaviour::getMirrorString(const QString &sou
}
case Scripted: {
- KateTemplateScript *script = KateGlobal::self()->scriptManager()->templateScript(m_templateScript);
+ KateTemplateScript *script = KTextEditor::EditorPrivate::self()->scriptManager()->templateScript(m_templateScript);
if (script) {
QString result = script->invoke(m_handler->view(), m_functionName, source);
diff --git a/src/variableeditor/variablelineedit.cpp b/src/variableeditor/variablelineedit.cpp
index 7c99e5a..836373a 100644
--- a/src/variableeditor/variablelineedit.cpp
+++ b/src/variableeditor/variablelineedit.cpp
@@ -124,7 +124,7 @@ void VariableLineEdit::addKateItems(VariableListView *listview)
KateViewConfig *viewConfig = KateViewConfig::global();
KateRendererConfig *rendererConfig = KateRendererConfig::global();
- if ((activeView = qobject_cast<KateView *>(KateGlobal::self()->application()->activeMainWindow()->activeView()))) {
+ if ((activeView = qobject_cast<KateView *>(KTextEditor::EditorPrivate::self()->application()->activeMainWindow()->activeView()))) {
activeDoc = activeView->doc();
viewConfig = activeView->config();
docConfig = activeDoc->config();
@@ -290,7 +290,7 @@ void VariableLineEdit::addKateItems(VariableListView *listview)
// Add 'scheme' to list
QStringList schemas;
- Q_FOREACH (const KateSchema &schema, KateGlobal::self()->schemaManager()->list()) {
+ Q_FOREACH (const KateSchema &schema, KTextEditor::EditorPrivate::self()->schemaManager()->list()) {
schemas.append(schema.rawName);
}
item = new VariableStringListItem(QLatin1String("scheme"), schemas, rendererConfig->schema());
diff --git a/src/view/kateanimation.cpp b/src/view/kateanimation.cpp
index af6b98b..01d734f 100644
--- a/src/view/kateanimation.cpp
+++ b/src/view/kateanimation.cpp
@@ -74,7 +74,7 @@ void KateAnimation::show()
// show according to effects config
if (m_widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, m_widget)
- || KateGlobal::unitTestMode() // due to timing issues in the unit test
+ || KTextEditor::EditorPrivate::unitTestMode() // due to timing issues in the unit test
) {
// launch show effect
// NOTE: use a singleShot timer to avoid resizing issues when showing the message widget the first time (bug #316666)
@@ -104,7 +104,7 @@ void KateAnimation::hide()
// hide according to effects config
if (m_widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, m_widget)
- || KateGlobal::unitTestMode() // due to timing issues in the unit test
+ || KTextEditor::EditorPrivate::unitTestMode() // due to timing issues in the unit test
) {
// hide depending on effect
if (m_fadeEffect) {
diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp
index db72713..39fcd57 100644
--- a/src/view/kateview.cpp
+++ b/src/view/kateview.cpp
@@ -136,7 +136,7 @@ KateView::KateView(KateDocument *doc, QWidget *parent, KTextEditor::MainWindow *
// queued connect to collapse view updates for range changes, INIT THIS EARLY ENOUGH!
connect(this, SIGNAL(delayedUpdateOfView()), this, SLOT(slotDelayedUpdateOfView()), Qt::QueuedConnection);
- KXMLGUIClient::setComponentName(KateGlobal::self()->aboutData().componentName(), KateGlobal::self()->aboutData().displayName());
+ KXMLGUIClient::setComponentName(KTextEditor::EditorPrivate::self()->aboutData().componentName(), KTextEditor::EditorPrivate::self()->aboutData().displayName());
// selection if for this view only and will invalidate if becoming empty
m_selection.setView(this);
@@ -144,7 +144,7 @@ KateView::KateView(KateDocument *doc, QWidget *parent, KTextEditor::MainWindow *
// use z depth defined in moving ranges interface
m_selection.setZDepth(-100000.0);
- KateGlobal::self()->registerView(this);
+ KTextEditor::EditorPrivate::self()->registerView(this);
/**
* try to let the main window, if any, create a view bar for this view
@@ -296,7 +296,7 @@ KateView::~KateView()
delete m_config;
- KateGlobal::self()->deregisterView(this);
+ KTextEditor::EditorPrivate::self()->deregisterView(this);
}
void KateView::setupConnections()
@@ -331,7 +331,7 @@ void KateView::setupActions()
a->setWhatsThis(i18n("Use this command to copy the currently selected text to the system clipboard."));
m_pasteMenu = ac->addAction(QLatin1String("edit_paste_menu"), new KatePasteMenu(i18n("Clipboard &History"), this));
- connect(KateGlobal::self(), SIGNAL(clipboardHistoryChanged()), this, SLOT(slotClipboardHistoryChanged()));
+ connect(KTextEditor::EditorPrivate::self(), SIGNAL(clipboardHistoryChanged()), this, SLOT(slotClipboardHistoryChanged()));
if (!m_doc->readOnly()) {
a = ac->addAction(KStandardAction::Save, m_doc, SLOT(documentSave()));
@@ -689,11 +689,11 @@ void KateView::setupActions()
void KateView::slotConfigDialog()
{
- KateGlobal::self()->configDialog(this);
+ KTextEditor::EditorPrivate::self()->configDialog(this);
// write config to global settings, else simple programs don't get config saved ever
// like Konqueror, Dolphin, ...
- KateGlobal::self()->writeConfig(KSharedConfig::openConfig().data());
+ KTextEditor::EditorPrivate::self()->writeConfig(KSharedConfig::openConfig().data());
}
void KateView::setupEditActions()
@@ -1193,7 +1193,7 @@ void KateView::slotReadWriteChanged()
m_cut->setEnabled(m_doc->isReadWrite() && (selection() || m_config->smartCopyCut()));
m_paste->setEnabled(m_doc->isReadWrite());
- m_pasteMenu->setEnabled(m_doc->isReadWrite() && !KateGlobal::self()->clipboardHistory().isEmpty());
+ m_pasteMenu->setEnabled(m_doc->isReadWrite() && !KTextEditor::EditorPrivate::self()->clipboardHistory().isEmpty());
m_setEndOfLine->setEnabled(m_doc->isReadWrite());
QStringList l;
@@ -1234,7 +1234,7 @@ void KateView::slotReadWriteChanged()
void KateView::slotClipboardHistoryChanged()
{
- m_pasteMenu->setEnabled(m_doc->isReadWrite() && !KateGlobal::self()->clipboardHistory().isEmpty());
+ m_pasteMenu->setEnabled(m_doc->isReadWrite() && !KTextEditor::EditorPrivate::self()->clipboardHistory().isEmpty());
}
void KateView::slotUpdateUndo()
@@ -1749,9 +1749,9 @@ void KateView::updateConfig()
reflectOnTheFlySpellCheckStatus(m_doc->isOnTheFlySpellCheckingEnabled());
// register/unregister word completion...
- unregisterCompletionModel(KateGlobal::self()->wordCompletionModel());
+ unregisterCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel());
if (config()->wordCompletion()) {
- registerCompletionModel(KateGlobal::self()->wordCompletionModel());
+ registerCompletionModel(KTextEditor::EditorPrivate::self()->wordCompletionModel());
}
m_cut->setEnabled(m_doc->isReadWrite() && (selection() || m_config->smartCopyCut()));
@@ -2207,7 +2207,7 @@ void KateView::copy() const
}
// copy to clipboard and our history!
- KateGlobal::self()->copyToClipboard(text);
+ KTextEditor::EditorPrivate::self()->copyToClipboard(text);
}
void KateView::applyWordWrap()
@@ -2304,7 +2304,7 @@ bool KateView::insertTemplateTextImplementation(const KTextEditor::Cursor &c,
/**
* get script
*/
- KateTemplateScript *kateTemplateScript = KateGlobal::self()->scriptManager()->templateScript(templateScript);
+ KateTemplateScript *kateTemplateScript = KTextEditor::EditorPrivate::self()->scriptManager()->templateScript(templateScript);
/**
* the handler will delete itself when necessary
diff --git a/src/view/kateviewhelpers.cpp b/src/view/kateviewhelpers.cpp
index 99f7328..18ae449 100644
--- a/src/view/kateviewhelpers.cpp
+++ b/src/view/kateviewhelpers.cpp
@@ -2504,7 +2504,7 @@ void KatePasteMenu::slotAboutToShow()
* insert complete paste history
*/
int i = 0;
- Q_FOREACH (const QString &text, KateGlobal::self()->clipboardHistory()) {
+ Q_FOREACH (const QString &text, KTextEditor::EditorPrivate::self()->clipboardHistory()) {
/**
* get text for the menu ;)
*/
@@ -2527,12 +2527,12 @@ void KatePasteMenu::paste()
// get index
int i = action->data().toInt();
- if (i >= KateGlobal::self()->clipboardHistory().size()) {
+ if (i >= KTextEditor::EditorPrivate::self()->clipboardHistory().size()) {
return;
}
// paste
- m_view->paste(&KateGlobal::self()->clipboardHistory()[i]);
+ m_view->paste(&KTextEditor::EditorPrivate::self()->clipboardHistory()[i]);
}
#include "kateviewhelpers.moc"
diff --git a/src/vimode/kateviemulatedcommandbar.cpp b/src/vimode/kateviemulatedcommandbar.cpp
index edd8aa0..c5cf432 100644
--- a/src/vimode/kateviemulatedcommandbar.cpp
+++ b/src/vimode/kateviemulatedcommandbar.cpp
@@ -438,12 +438,12 @@ void KateViEmulatedCommandBar::closed()
m_view->getViInputModeManager()->setLastSearchBackwards(m_currentSearchIsBackwards);
m_view->getViInputModeManager()->setLastSearchPlacesCursorAtEndOfMatch(m_currentSearchPlacesCursorAtEndOfMatch);
}
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(m_edit->text());
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(m_edit->text());
} else {
if (m_wasAborted) {
// Appending the command to the history when it is executed is handled elsewhere; we can't
// do it inside closed() as we may still be showing the command response display.
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem(m_edit->text());
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem(m_edit->text());
// With Vim, aborting a command returns us to Normal mode, even if we were in Visual Mode.
// If we switch from Visual to Normal mode, we need to clear the selection.
m_view->clearSelection();
@@ -583,7 +583,7 @@ void KateViEmulatedCommandBar::replaceCommandBeforeCursorWith(const QString &new
void KateViEmulatedCommandBar::activateSearchHistoryCompletion()
{
m_currentCompletionType = SearchHistory;
- m_completionModel->setStringList(reversed(KateGlobal::self()->viInputModeGlobal()->searchHistory()));
+ m_completionModel->setStringList(reversed(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->searchHistory()));
updateCompletionPrefix();
m_completer->complete();
}
@@ -621,16 +621,16 @@ void KateViEmulatedCommandBar::activateCommandCompletion()
void KateViEmulatedCommandBar::activateCommandHistoryCompletion()
{
m_currentCompletionType = CommandHistory;
- m_completionModel->setStringList(reversed(KateGlobal::self()->viInputModeGlobal()->commandHistory()));
+ m_completionModel->setStringList(reversed(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->commandHistory()));
updateCompletionPrefix();
m_completer->complete();
}
void KateViEmulatedCommandBar::activateSedFindHistoryCompletion()
{
- if (!KateGlobal::self()->viInputModeGlobal()->searchHistory().isEmpty()) {
+ if (!KTextEditor::EditorPrivate::self()->viInputModeGlobal()->searchHistory().isEmpty()) {
m_currentCompletionType = SedFindHistory;
- m_completionModel->setStringList(reversed(KateGlobal::self()->viInputModeGlobal()->searchHistory()));
+ m_completionModel->setStringList(reversed(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->searchHistory()));
m_completer->setCompletionPrefix(sedFindTerm());
m_completer->complete();
}
@@ -638,9 +638,9 @@ void KateViEmulatedCommandBar::activateSedFindHistoryCompletion()
void KateViEmulatedCommandBar::activateSedReplaceHistoryCompletion()
{
- if (!KateGlobal::self()->viInputModeGlobal()->replaceHistory().isEmpty()) {
+ if (!KTextEditor::EditorPrivate::self()->viInputModeGlobal()->replaceHistory().isEmpty()) {
m_currentCompletionType = SedReplaceHistory;
- m_completionModel->setStringList(reversed(KateGlobal::self()->viInputModeGlobal()->replaceHistory()));
+ m_completionModel->setStringList(reversed(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->replaceHistory()));
m_completer->setCompletionPrefix(sedReplaceTerm());
m_completer->complete();
}
@@ -937,7 +937,7 @@ bool KateViEmulatedCommandBar::handleKeyPress(const QKeyEvent *keyEvent)
if (keyEvent->modifiers() == Qt::ControlModifier && keyEvent->key() == Qt::Key_W) {
textToInsert = m_view->doc()->wordAt(m_view->cursorPosition());
} else {
- textToInsert = KateGlobal::self()->viInputModeGlobal()->getRegisterContent(key);
+ textToInsert = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisterContent(key);
}
if (m_insertedTextShouldBeEscapedForSearchingAsLiteral) {
textToInsert = escapedForSearchingAsLiteral(textToInsert);
@@ -1007,9 +1007,9 @@ bool KateViEmulatedCommandBar::handleKeyPress(const QKeyEvent *keyEvent)
const QString originalFindTerm = sedFindTerm();
const QString convertedFindTerm = vimRegexToQtRegexPattern(originalFindTerm);
const QString commandWithSedSearchRegexConverted = withSedFindTermReplacedWith(convertedFindTerm);
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(originalFindTerm);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(originalFindTerm);
const QString replaceTerm = sedReplaceTerm();
- KateGlobal::self()->viInputModeGlobal()->appendReplaceHistoryItem(replaceTerm);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendReplaceHistoryItem(replaceTerm);
commandToExecute = commandWithSedSearchRegexConverted;
qCDebug(LOG_PART) << "Command to execute after replacing search term: " << commandToExecute;
}
@@ -1022,7 +1022,7 @@ bool KateViEmulatedCommandBar::handleKeyPress(const QKeyEvent *keyEvent)
switchToCommandResponseDisplay(commandResponseMessage);
}
}
- KateGlobal::self()->viInputModeGlobal()->appendCommandHistoryItem(m_edit->text());
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendCommandHistoryItem(m_edit->text());
} else {
emit hideMe();
}
diff --git a/src/vimode/kateviinputmodemanager.cpp b/src/vimode/kateviinputmodemanager.cpp
index 3aee2c7..996f7a6 100644
--- a/src/vimode/kateviinputmodemanager.cpp
+++ b/src/vimode/kateviinputmodemanager.cpp
@@ -322,7 +322,7 @@ void KateViInputModeManager::startRecordingMacro(QChar macroRegister)
qCDebug(LOG_PART) << "Recording macro: " << macroRegister;
m_isRecordingMacro = true;
m_recordingMacroRegister = macroRegister;
- KateGlobal::self()->viInputModeGlobal()->clearMacro(macroRegister);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->clearMacro(macroRegister);
m_currentMacroKeyEventsLog.clear();
m_currentMacroCompletionsLog.clear();
}
@@ -331,7 +331,7 @@ void KateViInputModeManager::finishRecordingMacro()
{
Q_ASSERT(m_isRecordingMacro);
m_isRecordingMacro = false;
- KateGlobal::self()->viInputModeGlobal()->storeMacro(m_recordingMacroRegister, m_currentMacroKeyEventsLog, m_currentMacroCompletionsLog);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->storeMacro(m_recordingMacroRegister, m_currentMacroKeyEventsLog, m_currentMacroCompletionsLog);
}
bool KateViInputModeManager::isRecordingMacro()
@@ -346,12 +346,12 @@ void KateViInputModeManager::replayMacro(QChar macroRegister)
}
m_lastPlayedMacroRegister = macroRegister;
qCDebug(LOG_PART) << "Replaying macro: " << macroRegister;
- const QString macroAsFeedableKeypresses = KateGlobal::self()->viInputModeGlobal()->getMacro(macroRegister);
+ const QString macroAsFeedableKeypresses = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMacro(macroRegister);
qCDebug(LOG_PART) << "macroAsFeedableKeypresses: " << macroAsFeedableKeypresses;
m_macrosBeingReplayedCount++;
m_nextLoggedMacroCompletionIndex.push(0);
- m_macroCompletionsToReplay.push(KateGlobal::self()->viInputModeGlobal()->getMacroCompletions(macroRegister));
+ m_macroCompletionsToReplay.push(KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMacroCompletions(macroRegister));
m_keyMapperStack.push(QSharedPointer<KateViKeyMapper>(new KateViKeyMapper(this, m_view->doc(), m_view)));
feedKeyPresses(macroAsFeedableKeypresses);
m_keyMapperStack.pop();
@@ -468,7 +468,7 @@ void KateViInputModeManager::viEnterNormalMode()
if (r.isValid()) {
QString insertedText = m_view->doc()->text(r);
- KateGlobal::self()->viInputModeGlobal()->fillRegister(QLatin1Char('^'), insertedText);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->fillRegister(QLatin1Char('^'), insertedText);
}
addMark(m_view->doc(), QLatin1Char('^'), Cursor(m_view->cursorPosition()), false, false);
@@ -561,7 +561,7 @@ const QString KateViInputModeManager::getVerbatimKeys() const
void KateViInputModeManager::readSessionConfig(const KConfigGroup &config)
{
- if (KateGlobal::self()->viInputModeGlobal()->getRegisters()->size() > 0) {
+ if (KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisters()->size() > 0) {
QStringList names = config.readEntry("ViRegisterNames", QStringList());
QStringList contents = config.readEntry("ViRegisterContents", QStringList());
QList<int> flags = config.readEntry("ViRegisterFlags", QList<int>());
@@ -570,7 +570,7 @@ void KateViInputModeManager::readSessionConfig(const KConfigGroup &config)
if (names.size() == contents.size() && contents.size() == flags.size()) {
for (int i = 0; i < names.size(); i++) {
if (!names.at(i).isEmpty()) {
- KateGlobal::self()->viInputModeGlobal()->fillRegister(names.at(i).at(0), contents.at(i), (OperationMode)(flags.at(i)));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->fillRegister(names.at(i).at(0), contents.at(i), (OperationMode)(flags.at(i)));
}
}
}
@@ -597,8 +597,8 @@ void KateViInputModeManager::readSessionConfig(const KConfigGroup &config)
void KateViInputModeManager::writeSessionConfig(KConfigGroup &config)
{
- if (KateGlobal::self()->viInputModeGlobal()->getRegisters()->size() > 0) {
- const QMap<QChar, KateViRegister> *regs = KateGlobal::self()->viInputModeGlobal()->getRegisters();
+ if (KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisters()->size() > 0) {
+ const QMap<QChar, KateViRegister> *regs = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisters();
QStringList names, contents;
QList<int> flags;
QMap<QChar, KateViRegister>::const_iterator i;
diff --git a/src/vimode/katevikeymapper.cpp b/src/vimode/katevikeymapper.cpp
index e2a166b..4a9f76a 100644
--- a/src/vimode/katevikeymapper.cpp
+++ b/src/vimode/katevikeymapper.cpp
@@ -45,8 +45,8 @@ void KateViKeyMapper::executeMapping()
m_mappingKeys.clear();
m_mappingTimer->stop();
m_numMappingsBeingExecuted++;
- const QString mappedKeypresses = KateGlobal::self()->viInputModeGlobal()->getMapping(KateViGlobal::mappingModeForCurrentViMode(m_view), m_fullMappingMatch);
- if (!KateGlobal::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::mappingModeForCurrentViMode(m_view), m_fullMappingMatch)) {
+ const QString mappedKeypresses = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMapping(KateViGlobal::mappingModeForCurrentViMode(m_view), m_fullMappingMatch);
+ if (!KTextEditor::EditorPrivate::self()->viInputModeGlobal()->isMappingRecursive(KateViGlobal::mappingModeForCurrentViMode(m_view), m_fullMappingMatch)) {
qCDebug(LOG_PART) << "Non-recursive: " << mappedKeypresses;
m_doNotExpandFurtherMappings = true;
}
@@ -90,7 +90,7 @@ bool KateViKeyMapper::handleKeypress(QChar key)
bool isPartialMapping = false;
bool isFullMapping = false;
m_fullMappingMatch.clear();
- foreach (const QString &mapping, KateGlobal::self()->viInputModeGlobal()->getMappings(KateViGlobal::mappingModeForCurrentViMode(m_view))) {
+ foreach (const QString &mapping, KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getMappings(KateViGlobal::mappingModeForCurrentViMode(m_view))) {
if (mapping.startsWith(m_mappingKeys)) {
if (mapping == m_mappingKeys) {
isFullMapping = true;
diff --git a/src/vimode/katevimodebase.cpp b/src/vimode/katevimodebase.cpp
index df204a4..c808950 100644
--- a/src/vimode/katevimodebase.cpp
+++ b/src/vimode/katevimodebase.cpp
@@ -57,7 +57,7 @@ using KTextEditor::Range;
void KateViModeBase::yankToClipBoard(QChar chosen_register, QString text)
{
if ((chosen_register == QLatin1Char('0') || chosen_register == QLatin1Char('-')) && text.length() > 1) { //only yank to the clipboard if no register was specified and textlength > 1
- KateGlobal::self()->copyToClipboard(text);
+ KTextEditor::EditorPrivate::self()->copyToClipboard(text);
}
}
@@ -940,7 +940,7 @@ QChar KateViModeBase::getChosenRegister(const QChar &defaultReg) const
QString KateViModeBase::getRegisterContent(const QChar &reg)
{
- QString r = KateGlobal::self()->viInputModeGlobal()->getRegisterContent(reg);
+ QString r = KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisterContent(reg);
if (r.isNull()) {
error(i18n("Nothing in register %1", reg));
@@ -951,12 +951,12 @@ QString KateViModeBase::getRegisterContent(const QChar &reg)
OperationMode KateViModeBase::getRegisterFlag(const QChar &reg) const
{
- return KateGlobal::self()->viInputModeGlobal()->getRegisterFlag(reg);
+ return KTextEditor::EditorPrivate::self()->viInputModeGlobal()->getRegisterFlag(reg);
}
void KateViModeBase::fillRegister(const QChar &reg, const QString &text, OperationMode flag)
{
- KateGlobal::self()->viInputModeGlobal()->fillRegister(reg, text, flag);
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->fillRegister(reg, text, flag);
}
void KateViModeBase::addJump(KTextEditor::Cursor cursor)
@@ -1389,7 +1389,7 @@ void KateViModeBase::switchView(Direction direction)
{
QList<KateView *> visible_views;
- foreach (KateView *view, KateGlobal::self()->views()) {
+ foreach (KateView *view, KTextEditor::EditorPrivate::self()->views()) {
if (view->isVisible()) {
visible_views.push_back(view);
}
diff --git a/src/vimode/katevinormalmode.cpp b/src/vimode/katevinormalmode.cpp
index 24bbb5b..333f2b0 100644
--- a/src/vimode/katevinormalmode.cpp
+++ b/src/vimode/katevinormalmode.cpp
@@ -2701,7 +2701,7 @@ KateViRange KateViNormalMode::motionToPreviousBraceBlockEnd()
KateViRange KateViNormalMode::motionToNextOccurrence()
{
QString word = getWordUnderCursor();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(QString::fromLatin1("\\<%1\\>").arg(word));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(QString::fromLatin1("\\<%1\\>").arg(word));
word.prepend(QLatin1String("\\b")).append(QLatin1String("\\b"));
m_viInputModeManager->setLastSearchPattern(word);
@@ -2716,7 +2716,7 @@ KateViRange KateViNormalMode::motionToNextOccurrence()
KateViRange KateViNormalMode::motionToPrevOccurrence()
{
QString word = getWordUnderCursor();
- KateGlobal::self()->viInputModeGlobal()->appendSearchHistoryItem(QString::fromLatin1("\\<%1\\>").arg(word));
+ KTextEditor::EditorPrivate::self()->viInputModeGlobal()->appendSearchHistoryItem(QString::fromLatin1("\\<%1\\>").arg(word));
word.prepend(QLatin1String("\\b")).append(QLatin1String("\\b"));
m_viInputModeManager->setLastSearchPattern(word);