Bug 404925 - code completion popup content can change after the user selected an item
Summary: code completion popup content can change after the user selected an item
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: Code completion (show other bugs)
Version: 5.3.1
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-28 20:55 UTC by RJVB
Modified: 2019-02-28 20:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
tentative fix (705 bytes, text/plain)
2019-02-28 20:55 UTC, RJVB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2019-02-28 20:55:42 UTC
Created attachment 118445 [details]
tentative fix

SUMMARY
It is possible (and often too easy) to insert an unwanted entry from the code completion popup, i.e. some unforeseen entry that gets inserted under the cursor *after* you hit the Enter key but before that event is processed. Sometimes I even get the result of an entirely unexpected code completion when the popup appears just before my tap on the Enter key lands or the keypress gets registered.

STEPS TO REPRODUCE
1. Activate automatic appearance of the completion popup

OBSERVED RESULT
As described in the summary, happening more frequently with documents with lots of headers and code that leads to long lists with completion candidates. I can't affirm that it happens more often on my slower machine than on my faster machine but it does happen more often when I'm keeping the machine busy (and is elusive when you want to trigger it).

EXPECTED RESULT
Deterministic behaviour...


SOFTWARE/OS VERSIONS
KDE Frameworks Version: 5.52.0
Qt Version: 5.9.7

ADDITIONAL INFORMATION
A few possible solutions:
- a user-configurable "select this entry" would prevent accidental code completion when all you want is just enter a newline
- make it impossible to accept an entry from the list if the list isn't yet complete 
OR
- activate the feature only when the list is complete.

I'm attaching a tiny patch that appears to achieve the latter solution by using the waitForReset signal.