From 970e88dfd077895f08b61a206192dd45bceefe39 Mon Sep 17 00:00:00 2001 From: Jan Sundermeyer Date: Fri, 20 Dec 2024 19:31:00 +0100 Subject: [PATCH] add env filter for auto completer --- src/latexeditorview.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/latexeditorview.cpp b/src/latexeditorview.cpp index cf7fef51c..f33ef873f 100644 --- a/src/latexeditorview.cpp +++ b/src/latexeditorview.cpp @@ -212,6 +212,14 @@ bool DefaultInputBinding::keyPressEvent(QKeyEvent *event, QEditor *editor) else { EnumsTokenType::TokenType ctx = Parsing::getCompleterContext(editor->cursor().line().handle(), editor->cursor().columnNumber()); if(ctx==EnumsTokenType::def) return true; + // check for environment + const LatexDocument *doc = qobject_cast(editor->document()); + StackEnvironment env; + doc->getEnv(editor->cursor().lineNumber(),env); + if(!env.isEmpty() && env.top().name=="%expl3"){ + LatexEditorView::completer->setFilter("%expl3"); + } + LatexCompleter::CompletionFlags flags= ctx==EnumsTokenType::width ? LatexCompleter::CF_FORCE_LENGTH : LatexCompleter::CompletionFlag(0) ; LatexEditorView::completer->complete(editor, flags); }