From 9bf361d5a581912f924d396f1d04556e5429efff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 22 Apr 2020 17:21:29 +0200 Subject: [PATCH] [apps/code] Autocomplete only after edition Reverts 39c3d66cd --- apps/code/python_text_area.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/code/python_text_area.cpp b/apps/code/python_text_area.cpp index ef92ce613..b4be26104 100644 --- a/apps/code/python_text_area.cpp +++ b/apps/code/python_text_area.cpp @@ -245,8 +245,11 @@ bool PythonTextArea::handleEvent(Ion::Events::Event event) { } } bool result = TextArea::handleEvent(event); - if (!m_contentView.isAutocompleting() && selectionIsEmpty()) { - // Add autocompletion after each event handled, if nothing is selected + if (event == Ion::Events::Backspace && !m_contentView.isAutocompleting() && selectionIsEmpty()) { + /* We want to add autocompletion when we are editing a word (after adding or + * deleting text). So if nothing is selected, we add the autocompletion if + * the event is backspace, as autocompletion has already been added if the + * event added text, in handleEventWithText. */ addAutocompletion(); } return result;