diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -507,7 +507,7 @@ 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', - 'rsrc/js/phuix/PHUIXAutocomplete.js' => '3601bdd1', + 'rsrc/js/phuix/PHUIXAutocomplete.js' => '569edc21', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', 'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997', 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', @@ -836,7 +836,7 @@ 'phui-workpanel-view-css' => 'adec7699', 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => '8cf6d262', - 'phuix-autocomplete' => '3601bdd1', + 'phuix-autocomplete' => '569edc21', 'phuix-dropdown-menu' => 'bd4c8dca', 'phuix-form-control-view' => '8fba1997', 'phuix-icon-view' => 'bff6884b', @@ -1064,12 +1064,6 @@ 'javelin-vector', 'phuix-autocomplete', ), - '3601bdd1' => array( - 'javelin-install', - 'javelin-dom', - 'phuix-icon-view', - 'phabricator-prefab', - ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1210,6 +1204,12 @@ 'javelin-vector', 'javelin-dom', ), + '569edc21' => array( + 'javelin-install', + 'javelin-dom', + 'phuix-icon-view', + 'phabricator-prefab', + ), '56a1ca03' => array( 'javelin-behavior', 'javelin-behavior-device', diff --git a/webroot/rsrc/js/phuix/PHUIXAutocomplete.js b/webroot/rsrc/js/phuix/PHUIXAutocomplete.js --- a/webroot/rsrc/js/phuix/PHUIXAutocomplete.js +++ b/webroot/rsrc/js/phuix/PHUIXAutocomplete.js @@ -276,7 +276,13 @@ }, _getSuffixes: function() { - return[' ', ':', ',']; + return [' ', ':', ',', ')']; + }, + + _getCancelCharacters: function() { + // The "." character does not cancel because of projects named + // "node.js" or "blog.mycompany.com". + return ['#', '@', ',', '!', '?']; }, _trim: function(str) { @@ -392,6 +398,18 @@ var trim = this._trim(text); + // Deactivate immediately if a user types a character that we are + // reasonably sure means they don't want to use the autocomplete. For + // example, "##" is almost certainly a header or monospaced text, not + // a project autocompletion. + var cancels = this._getCancelCharacters(); + for (var ii = 0; ii < cancels.length; ii++) { + if (trim.indexOf(cancels[ii]) !== -1) { + this._deactivate(); + return; + } + } + this._datasource.didChange(trim); var node = this._getNode();