Commit 7ba6e27b authored by Ilia Kats's avatar Ilia Kats Committed by Christoph Cullmann
Browse files

override shouldStartCompletion

otherwise we don't get automatic completion for ^(, ^) and such
parent 0851c9d3
......@@ -44,6 +44,13 @@ void LatexCompletionModel::completionInvoked(KTextEditor::View *view,
endResetModel();
}
bool LatexCompletionModel::shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
{
Q_UNUSED(view);
Q_UNUSED(position);
return userInsertion && latexexpr.match(insertedText).hasMatch();
}
bool LatexCompletionModel::shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString &currentCompletion)
{
if (view->cursorPosition() < range.start() || view->cursorPosition() > range.end())
......
......@@ -27,6 +27,7 @@ class LatexCompletionModel : public KTextEditor::CodeCompletionModel, public KTe
public:
LatexCompletionModel(QObject *parent);
KTextEditor::Range completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position) override;
bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position) override;
bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString &currentCompletion) override;
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType) override;
void executeCompletionItem(KTextEditor::View *view, const KTextEditor::Range &word, const QModelIndex &index) const override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment