@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.

Deactivate the remarkup autosuggest once text can't match "[[" or "((" rules

Summary:
See PHI1185, which reports a performance issue with "(" in remarkup in certain contexts.

I can't reproduce the performance issue, but I can reproduce the autosuggester incorrectly remaining active and swallowing return characters.

When the user types `(` or `[`, we wait for a prefix for the `((` (Phurl) or `[[` (Phriction) rules. We currently continue looking for that prefix until a character is entered that explicitly interrupts the search.

For example, typing `(xxx<return>` does not insert a return character, because we're stuck on matching the prefix.

Instead, as soon as the user has entered text that we know won't ever match the prefix, deactivate the autocomplete. We can slightly cheat through this by just looking for at least one character of text, since all prefixes are exactly one character long. If we eventually have some kind of `~~@(xyz)` rule we might need to add a more complicated piece of rejection logic.

Test Plan: Typed `(xxx<return>`, got a return. Used `((` and `[[` autosuggest rules normally. Used `JX.log()` to sanity check that nothing too crazy seems to be happening.

Reviewers: amckinley

Reviewed By: amckinley

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

+15 -8
+8 -8
resources/celerity/map.php
··· 516 516 'rsrc/js/phui/behavior-phui-timer-control.js' => 'f84bcbf4', 517 517 'rsrc/js/phuix/PHUIXActionListView.js' => 'c68f183f', 518 518 'rsrc/js/phuix/PHUIXActionView.js' => 'aaa08f3b', 519 - 'rsrc/js/phuix/PHUIXAutocomplete.js' => '8f139ef0', 519 + 'rsrc/js/phuix/PHUIXAutocomplete.js' => '2fbe234d', 520 520 'rsrc/js/phuix/PHUIXButtonView.js' => '55a24e84', 521 521 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bdce4d78', 522 522 'rsrc/js/phuix/PHUIXExample.js' => 'c2c500a7', ··· 872 872 'phui-workpanel-view-css' => '3ae89b20', 873 873 'phuix-action-list-view' => 'c68f183f', 874 874 'phuix-action-view' => 'aaa08f3b', 875 - 'phuix-autocomplete' => '8f139ef0', 875 + 'phuix-autocomplete' => '2fbe234d', 876 876 'phuix-button-view' => '55a24e84', 877 877 'phuix-dropdown-menu' => 'bdce4d78', 878 878 'phuix-form-control-view' => '38c1f3fb', ··· 1173 1173 'phuix-autocomplete', 1174 1174 'javelin-mask', 1175 1175 ), 1176 + '2fbe234d' => array( 1177 + 'javelin-install', 1178 + 'javelin-dom', 1179 + 'phuix-icon-view', 1180 + 'phabricator-prefab', 1181 + ), 1176 1182 '308f9fe4' => array( 1177 1183 'javelin-install', 1178 1184 'javelin-util', ··· 1633 1639 ), 1634 1640 '8e2d9a28' => array( 1635 1641 'phui-theme-css', 1636 - ), 1637 - '8f139ef0' => array( 1638 - 'javelin-install', 1639 - 'javelin-dom', 1640 - 'phuix-icon-view', 1641 - 'phabricator-prefab', 1642 1642 ), 1643 1643 '8f959ad0' => array( 1644 1644 'javelin-behavior',
+7
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
··· 555 555 if (prefix) { 556 556 var pattern = new RegExp(prefix); 557 557 if (!trim.match(pattern)) { 558 + // If the prefix pattern can not match the text, deactivate. (This 559 + // check might need to be more careful if we have a more varied 560 + // set of prefixes in the future, but for now they're all a single 561 + // prefix character.) 562 + if (trim.length) { 563 + this._deactivate(); 564 + } 558 565 return; 559 566 } 560 567 trim = trim.replace(pattern, '');