@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 deactivate remarkup autocomplete if there's no query

Summary:
Fixes T12479. If you end a line with a character like ":" in a context which can trigger autocomplete (e.g., `.:`), then try to make a newline, we swallow the keystroke.

Instead, allow the keystroke through if the user hasn't typed anything else yet.

Test Plan:
- Autocompleted emoji and users normally.
- In an empty textarea, typed `.:<return>`, got a newline instead of a swallowed keystroke.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12479

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

+27 -18
+8 -8
resources/celerity/map.php
··· 528 528 'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9', 529 529 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 530 530 'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b', 531 - 'rsrc/js/phuix/PHUIXAutocomplete.js' => '7910aacb', 531 + 'rsrc/js/phuix/PHUIXAutocomplete.js' => 'd5b2abf3', 532 532 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50', 533 533 'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671', 534 534 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', ··· 885 885 'phui-workpanel-view-css' => 'a3a63478', 886 886 'phuix-action-list-view' => 'b5c256b8', 887 887 'phuix-action-view' => 'b3465b9b', 888 - 'phuix-autocomplete' => '7910aacb', 888 + 'phuix-autocomplete' => 'd5b2abf3', 889 889 'phuix-dropdown-menu' => '8018ee50', 890 890 'phuix-form-control-view' => '83e03671', 891 891 'phuix-icon-view' => 'bff6884b', ··· 1456 1456 'multirow-row-manager', 1457 1457 'javelin-json', 1458 1458 ), 1459 - '7910aacb' => array( 1460 - 'javelin-install', 1461 - 'javelin-dom', 1462 - 'phuix-icon-view', 1463 - 'phabricator-prefab', 1464 - ), 1465 1459 '7927a7d3' => array( 1466 1460 'javelin-behavior', 1467 1461 'javelin-quicksand', ··· 2052 2046 'javelin-dom', 2053 2047 'javelin-uri', 2054 2048 'phabricator-notification', 2049 + ), 2050 + 'd5b2abf3' => array( 2051 + 'javelin-install', 2052 + 'javelin-dom', 2053 + 'phuix-icon-view', 2054 + 'phabricator-prefab', 2055 2055 ), 2056 2056 'd6a7e717' => array( 2057 2057 'multirow-row-manager',
+19 -10
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
··· 433 433 } 434 434 } 435 435 436 + // Deactivate if the user moves the cursor to the left of the assist 437 + // range. For example, they might press the "left" arrow to move the 438 + // cursor to the left, or click in the textarea prior to the active 439 + // range. 440 + var range = JX.TextAreaUtils.getSelectionRange(area); 441 + if (range.start < this._cursorHead) { 442 + this._deactivate(); 443 + return; 444 + } 445 + 436 446 if (special == 'tab' || special == 'return') { 437 447 var r = e.getRawEvent(); 438 448 if (r.shiftKey && special == 'tab') { ··· 443 453 return; 444 454 } 445 455 456 + // If the user hasn't typed any text yet after typing the character 457 + // which can summon the autocomplete, deactivate and let the keystroke 458 + // through. For example, We hit this when a line ends with an 459 + // autocomplete character and the user is trying to type a newline. 460 + if (range.start == this._cursorHead) { 461 + this._deactivate(); 462 + return; 463 + } 464 + 446 465 // If we autocomplete, we're done. Otherwise, just eat the event. This 447 466 // happens if you type too fast and try to tab complete before results 448 467 // load. ··· 451 470 } 452 471 453 472 e.kill(); 454 - return; 455 - } 456 - 457 - // Deactivate if the user moves the cursor to the left of the assist 458 - // range. For example, they might press the "left" arrow to move the 459 - // cursor to the left, or click in the textarea prior to the active 460 - // range. 461 - var range = JX.TextAreaUtils.getSelectionRange(area); 462 - if (range.start < this._cursorHead) { 463 - this._deactivate(); 464 473 return; 465 474 } 466 475