Skip to content

Cancel automatic running if the query string changes

Tony Wasserka requested to merge twasserka/milou:master into master

Fixes https://bugs.kde.org/show_bug.cgi?id=440010.

Previously, automatic running could have surprising behavior when the user attempted to correct mistyped queries. For instance, typing "writr" and pressing enter wouldn't directly launch a process, but once the user attempted to correct their input using the backspace key, the first match starting with "writ" would be launched immediately without an apparent causal connection.

Alternatively to the proposed changes, we could reset the existing runAutomatically variable for certain events (e.g. pressing backspace). This seems fragile though, as there are many ways the user might attempt to correct their query that aren't easy to check for (e.g. select parts of the query string and press 'a' to replace them with that character). The prefix string seems to reflect the user intent closest and showed intuitive behavior during (limited) personal testing. (This referred to an old version of this MR, which proposed very different changes)

There is a related issue that is not fixed by this MR: If the user hits enter "too early" and keeps typing characters to constrain the set of results, the result picked by automatic running might not actually match the new query string anymore. Is there a good way to read the first query result in the data model from within the QML code? If not, do you have any other suggestions on how to best handle this case, implementation-wise? (Opted for handling this by canceling any launches after Enter is pressed)

Edited by Tony Wasserka

Merge request reports