Page MenuHomePhabricator

D17583.diff
No OneTemporary

D17583.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -528,7 +528,7 @@
'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9',
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b',
- 'rsrc/js/phuix/PHUIXAutocomplete.js' => '7910aacb',
+ 'rsrc/js/phuix/PHUIXAutocomplete.js' => 'd5b2abf3',
'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50',
'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671',
'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b',
@@ -885,7 +885,7 @@
'phui-workpanel-view-css' => 'a3a63478',
'phuix-action-list-view' => 'b5c256b8',
'phuix-action-view' => 'b3465b9b',
- 'phuix-autocomplete' => '7910aacb',
+ 'phuix-autocomplete' => 'd5b2abf3',
'phuix-dropdown-menu' => '8018ee50',
'phuix-form-control-view' => '83e03671',
'phuix-icon-view' => 'bff6884b',
@@ -1456,12 +1456,6 @@
'multirow-row-manager',
'javelin-json',
),
- '7910aacb' => array(
- 'javelin-install',
- 'javelin-dom',
- 'phuix-icon-view',
- 'phabricator-prefab',
- ),
'7927a7d3' => array(
'javelin-behavior',
'javelin-quicksand',
@@ -2053,6 +2047,12 @@
'javelin-uri',
'phabricator-notification',
),
+ 'd5b2abf3' => array(
+ 'javelin-install',
+ 'javelin-dom',
+ 'phuix-icon-view',
+ 'phabricator-prefab',
+ ),
'd6a7e717' => array(
'multirow-row-manager',
'javelin-install',
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
@@ -433,6 +433,16 @@
}
}
+ // Deactivate if the user moves the cursor to the left of the assist
+ // range. For example, they might press the "left" arrow to move the
+ // cursor to the left, or click in the textarea prior to the active
+ // range.
+ var range = JX.TextAreaUtils.getSelectionRange(area);
+ if (range.start < this._cursorHead) {
+ this._deactivate();
+ return;
+ }
+
if (special == 'tab' || special == 'return') {
var r = e.getRawEvent();
if (r.shiftKey && special == 'tab') {
@@ -443,6 +453,15 @@
return;
}
+ // If the user hasn't typed any text yet after typing the character
+ // which can summon the autocomplete, deactivate and let the keystroke
+ // through. For example, We hit this when a line ends with an
+ // autocomplete character and the user is trying to type a newline.
+ if (range.start == this._cursorHead) {
+ this._deactivate();
+ return;
+ }
+
// If we autocomplete, we're done. Otherwise, just eat the event. This
// happens if you type too fast and try to tab complete before results
// load.
@@ -454,16 +473,6 @@
return;
}
- // Deactivate if the user moves the cursor to the left of the assist
- // range. For example, they might press the "left" arrow to move the
- // cursor to the left, or click in the textarea prior to the active
- // range.
- var range = JX.TextAreaUtils.getSelectionRange(area);
- if (range.start < this._cursorHead) {
- this._deactivate();
- return;
- }
-
// Deactivate if the user moves the cursor to the right of the assist
// range. For example, they might click later in the document. If the user
// is pressing the "right" arrow key, they are not allowed to move the

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 3:41 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286384
Default Alt Text
D17583.diff (3 KB)

Event Timeline