Changeset View
Changeset View
Standalone View
Standalone View
completion/keyworditem.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 46 | { | |||
---|---|---|---|---|---|
66 | return NormalDeclarationCompletionItem::data(index, role, model); | 66 | return NormalDeclarationCompletionItem::data(index, role, model); | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | void KeywordItem::execute(KTextEditor::View* view, const KTextEditor::Range& word) | 69 | void KeywordItem::execute(KTextEditor::View* view, const KTextEditor::Range& word) | ||
70 | { | 70 | { | ||
71 | KTextEditor::Document *document = view->document(); | 71 | KTextEditor::Document *document = view->document(); | ||
72 | if ( !m_replacement.isEmpty() ) { | 72 | if ( !m_replacement.isEmpty() ) { | ||
73 | QString replacement = m_replacement; | 73 | QString replacement = m_replacement; | ||
74 | replacement = replacement.replace('\n', '\n' + getIndendation(document->line(word.start().line()))); | 74 | replacement = replacement.replace('\n', '\n' + getIndentation(document->line(word.start().line()))); | ||
75 | replacement = replacement.replace(QLatin1String("%INDENT%"), indentString(document)); | 75 | replacement = replacement.replace(QLatin1String("%INDENT%"), indentString(document)); | ||
76 | 76 | | |||
77 | int cursorPos = replacement.indexOf(QStringLiteral("%CURSOR%")); | 77 | int cursorPos = replacement.indexOf(QStringLiteral("%CURSOR%")); | ||
78 | int selectionEnd = -1; | 78 | int selectionEnd = -1; | ||
79 | if ( cursorPos != -1 ) { | 79 | if ( cursorPos != -1 ) { | ||
80 | replacement.remove(QStringLiteral("%CURSOR%")); | 80 | replacement.remove(QStringLiteral("%CURSOR%")); | ||
81 | } else { | 81 | } else { | ||
82 | cursorPos = replacement.indexOf(QStringLiteral("%SELECT%")); | 82 | cursorPos = replacement.indexOf(QStringLiteral("%SELECT%")); | ||
Show All 40 Lines |