@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Immediately cancel autocomplete if the user types certain characters anywhere

Summary:
Ref T10163. Some characters are almost certainly punctuation or markup rather than autocomplete requests. Immediately cancel any active autocomplete when the user types one of these.

Note that some of these are also suffix characters. If you type `@dog,`, you have until the next character to decide you actually mean to autocomplete. Once you type something else we deactivate.

If you type `#dog#` or `##`, we deactivate immediately.

Test Plan: Typed `@dog#`, etc.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10163

Differential Revision: https://secure.phabricator.com/D15036

+27 -9
+8 -8
resources/celerity/map.php
··· 507 507 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', 508 508 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 509 509 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', 510 - 'rsrc/js/phuix/PHUIXAutocomplete.js' => '3601bdd1', 510 + 'rsrc/js/phuix/PHUIXAutocomplete.js' => '569edc21', 511 511 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', 512 512 'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997', 513 513 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', ··· 836 836 'phui-workpanel-view-css' => 'adec7699', 837 837 'phuix-action-list-view' => 'b5c256b8', 838 838 'phuix-action-view' => '8cf6d262', 839 - 'phuix-autocomplete' => '3601bdd1', 839 + 'phuix-autocomplete' => '569edc21', 840 840 'phuix-dropdown-menu' => 'bd4c8dca', 841 841 'phuix-form-control-view' => '8fba1997', 842 842 'phuix-icon-view' => 'bff6884b', ··· 1064 1064 'javelin-vector', 1065 1065 'phuix-autocomplete', 1066 1066 ), 1067 - '3601bdd1' => array( 1068 - 'javelin-install', 1069 - 'javelin-dom', 1070 - 'phuix-icon-view', 1071 - 'phabricator-prefab', 1072 - ), 1073 1067 '3ab51e2c' => array( 1074 1068 'javelin-behavior', 1075 1069 'javelin-behavior-device', ··· 1209 1203 'javelin-behavior', 1210 1204 'javelin-vector', 1211 1205 'javelin-dom', 1206 + ), 1207 + '569edc21' => array( 1208 + 'javelin-install', 1209 + 'javelin-dom', 1210 + 'phuix-icon-view', 1211 + 'phabricator-prefab', 1212 1212 ), 1213 1213 '56a1ca03' => array( 1214 1214 'javelin-behavior',
+19 -1
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
··· 276 276 }, 277 277 278 278 _getSuffixes: function() { 279 - return[' ', ':', ',']; 279 + return [' ', ':', ',', ')']; 280 + }, 281 + 282 + _getCancelCharacters: function() { 283 + // The "." character does not cancel because of projects named 284 + // "node.js" or "blog.mycompany.com". 285 + return ['#', '@', ',', '!', '?']; 280 286 }, 281 287 282 288 _trim: function(str) { ··· 391 397 } 392 398 393 399 var trim = this._trim(text); 400 + 401 + // Deactivate immediately if a user types a character that we are 402 + // reasonably sure means they don't want to use the autocomplete. For 403 + // example, "##" is almost certainly a header or monospaced text, not 404 + // a project autocompletion. 405 + var cancels = this._getCancelCharacters(); 406 + for (var ii = 0; ii < cancels.length; ii++) { 407 + if (trim.indexOf(cancels[ii]) !== -1) { 408 + this._deactivate(); 409 + return; 410 + } 411 + } 394 412 395 413 this._datasource.didChange(trim); 396 414