diff --git a/apps/code/python_text_area.cpp b/apps/code/python_text_area.cpp index e1fe0a923..f0ed0ff99 100644 --- a/apps/code/python_text_area.cpp +++ b/apps/code/python_text_area.cpp @@ -54,6 +54,9 @@ static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) { return lex->column - lex->tok_column; } bool PythonTextArea::shouldAutocomplete(const char * autocompletionLocation) const { + if (isAutocompleting()) { + return true; + } const char * location = autocompletionLocation != nullptr ? autocompletionLocation : cursorLocation(); CodePoint prevCodePoint = UTF8Helper::PreviousCodePoint(m_contentView.editedText(), location); return !UTF8Helper::CodePointIsEndOfWord(prevCodePoint) diff --git a/apps/code/python_text_area.h b/apps/code/python_text_area.h index 755f791c1..1bbcd2531 100644 --- a/apps/code/python_text_area.h +++ b/apps/code/python_text_area.h @@ -18,6 +18,9 @@ public: void unloadSyntaxHighlighter() { m_contentView.unloadSyntaxHighlighter(); } bool handleEvent(Ion::Events::Event event) override; bool handleEventWithText(const char * text, bool indentation = false, bool forceCursorRightOfText = false) override; + /* shouldAutocomplete returns true if there is currently autocompletion, or if + * there should be autocompletion but there is not because there is no word to + * autocomplete. */ bool shouldAutocomplete(const char * autocompletionLocation = nullptr) const; bool isAutocompleting() const { return m_contentView.isAutocompleting(); } protected: