Page MenuHomePhabricator

D15033.id36313.diff
No OneTemporary

D15033.id36313.diff

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' => '3d6e37cc',
+ 'rsrc/js/phuix/PHUIXAutocomplete.js' => '3dfff01f',
'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' => '3d6e37cc',
+ 'phuix-autocomplete' => '3dfff01f',
'phuix-dropdown-menu' => 'bd4c8dca',
'phuix-form-control-view' => '8fba1997',
'phuix-icon-view' => 'bff6884b',
@@ -1080,7 +1080,7 @@
'javelin-util',
'javelin-uri',
),
- '3d6e37cc' => array(
+ '3dfff01f' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
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
@@ -119,6 +119,16 @@
return;
}
+ // Get all the text on the current line. If the line begins with
+ // whitespace, don't activate: the user is probably typing code or a
+ // numbered list.
+ var line = area.value.substring(0, head);
+ line = line.split('\n');
+ line = line[line.length - 1];
+ if (line.match(/^\s+/)) {
+ return;
+ }
+
this._cursorHead = head;
this._cursorTail = range.end;
this._pixelHead = JX.TextAreaUtils.getPixelDimensions(
@@ -370,6 +380,13 @@
var x = this._pixelHead.start.x;
var y = Math.max(this._pixelHead.end.y, pixels.end.y) + 24;
+ // If the first character after the trigger is a space, just deactivate
+ // immediately. This occurs if a user types a numbered list using "#".
+ if (text.length && text[0] == ' ') {
+ this._deactivate();
+ return;
+ }
+
var trim = this._trim(text);
this._datasource.didChange(trim);

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 21, 8:44 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6290920
Default Alt Text
D15033.id36313.diff (2 KB)

Event Timeline