diff --git a/apps/code/python_text_area.cpp b/apps/code/python_text_area.cpp index dff91f6f3..821895b2b 100644 --- a/apps/code/python_text_area.cpp +++ b/apps/code/python_text_area.cpp @@ -412,11 +412,10 @@ void PythonTextArea::acceptAutocompletion(bool moveCursorToEndOfAutocompletion) m_contentView.pythonDelegate()->variableBoxController()->setSender(this); m_contentView.pythonDelegate()->variableBoxController()->insertAutocompletionResultAtIndex(m_autocompletionResultIndex); - /* Add the autocompletion if we moved the cursor. If we did not want to move - * the cursor, restore its position. */ - if (moveCursorToEndOfAutocompletion) { - addAutocompletion(); - } else { + // insertAutocompletionResultAtIndex already added the autocompletion + + // If we did not want to move the cursor, restore its position. + if (!moveCursorToEndOfAutocompletion) { setCursorLocation(previousCursorLocation); } }