Username completions: always abandon if the first input is a space

This has been added to the core behavior of shouldAbandon as well, but
the way it's overridden here needs to be changed since the
multiple-words check would override that.

Depends-On: If130cdc1df595e6ab12d531ce603cc42c8b3b5f3
Change-Id: Ie7bdc4a4702514fcb7d500924dad18729198b9e8
This commit is contained in:
David Lynch 2023-05-20 09:47:40 +03:00
parent 4bcee681fc
commit 5568761377

View file

@ -231,7 +231,12 @@ MWUsernameCompletionAction.prototype.insertCompletion = function ( word, range )
MWUsernameCompletionAction.prototype.shouldAbandon = function ( input ) {
// TODO: need to consider whether pending loads from server are happening here
return MWUsernameCompletionAction.super.prototype.shouldAbandon.apply( this, arguments ) && input.split( /\s+/ ).length > 2;
return MWUsernameCompletionAction.super.prototype.shouldAbandon.apply( this, arguments ) && (
// Abandon if the user hit space immediately
input.match( /^\s+$/ ) ||
// Abandon if there's more than two words entered without a match
input.split( /\s+/ ).length > 2
);
};
/* Registration */