mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Improve autocomplete behavior in lists and with noncompleting results
Summary: Ref T10163. Currently, we don't activate on indented lines, but were too aggressive about this, and would not activate on lines like ` - Hey, @user...`, where we should. Instead, don't activate on indented lines if there's only an indent (i.e., `#` probably means enumerated list). Also, if results don't have autocompletes (rare but possible with projects missing slugs), improve behavior. Test Plan: - Typed ` #a`, got no autocomplete. - Missing slug thing is a pain to test locallly, `#1 z z z z` reproduces in production. I'll just verify it there. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10163 Differential Revision: https://secure.phabricator.com/D15040
This commit is contained in:
parent
75b8d3312b
commit
75781dba1a
2 changed files with 17 additions and 12 deletions
|
@ -507,7 +507,7 @@ return array(
|
|||
'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' => '0abdd4a8',
|
||||
'rsrc/js/phuix/PHUIXAutocomplete.js' => '8bbbad27',
|
||||
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
|
||||
'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997',
|
||||
'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b',
|
||||
|
@ -836,7 +836,7 @@ return array(
|
|||
'phui-workpanel-view-css' => 'adec7699',
|
||||
'phuix-action-list-view' => 'b5c256b8',
|
||||
'phuix-action-view' => '8cf6d262',
|
||||
'phuix-autocomplete' => '0abdd4a8',
|
||||
'phuix-autocomplete' => '8bbbad27',
|
||||
'phuix-dropdown-menu' => 'bd4c8dca',
|
||||
'phuix-form-control-view' => '8fba1997',
|
||||
'phuix-icon-view' => 'bff6884b',
|
||||
|
@ -917,12 +917,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-router',
|
||||
),
|
||||
'0abdd4a8' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'phuix-icon-view',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'0b7a4f6e' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-typeahead-ondemand-source',
|
||||
|
@ -1495,6 +1489,12 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'8bbbad27' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'phuix-icon-view',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'8bdb2835' => array(
|
||||
'phui-fontkit-css',
|
||||
),
|
||||
|
|
|
@ -127,13 +127,13 @@ JX.install('PHUIXAutocomplete', {
|
|||
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
|
||||
// Get all the text on the current line. If the line only contains
|
||||
// whitespace, don't actiavte: the user is probably typing code or a
|
||||
// numbered list.
|
||||
var line = area.value.substring(0, head);
|
||||
var line = area.value.substring(0, head - 1);
|
||||
line = line.split('\n');
|
||||
line = line[line.length - 1];
|
||||
if (line.match(/^\s+/)) {
|
||||
if (line.match(/^\s+$/)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,6 +223,11 @@ JX.install('PHUIXAutocomplete', {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!result.autocomplete || !result.autocomplete.length) {
|
||||
hits = null;
|
||||
break;
|
||||
}
|
||||
|
||||
hits.push(result.autocomplete);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue