Support q hotkey to Search people.

(imported from commit eafaf5900461e2df52de9ddbdc49823bf6d9e403)
This commit is contained in:
Steve Howell 2014-02-14 16:49:26 -05:00
parent 2d09036466
commit 2c6d7e8e18
3 changed files with 15 additions and 1 deletions

View File

@ -372,6 +372,11 @@ exports.escape_search = function () {
update_users_for_search();
};
exports.initiate_search = function () {
var filter = $('.user-list-filter').expectOne();
filter.focus();
};
exports.blur_search = function () {
$('.user-list-filter').blur();
};

View File

@ -85,6 +85,8 @@ function get_event_name(e) {
return 'vim_down';
case 107: // 'k'
return 'vim_up';
case 113: // 'q'
return 'query_users';
case 114: // 'r': respond to message
return 'reply_message';
case 115: // 's'
@ -115,7 +117,7 @@ function process_hotkey(e) {
}
}
if (ui.home_tab_obscured() && event_name !== 'search') {
if (ui.home_tab_obscured() && event_name !== 'search' && event_name !== 'query_users') {
return false;
}
@ -260,6 +262,9 @@ function process_hotkey(e) {
case 'compose_private_message':
compose.start('private', {trigger: "compose_hotkey"});
return true;
case 'query_users':
activity.initiate_search();
return true;
case 'search':
search.initiate_search();
return true;

View File

@ -15,6 +15,10 @@
<td class="hotkey">/</td>
<td class="definition">Initiate a search</td>
</tr>
<tr>
<td class="hotkey">q</td>
<td class="definition">Search people</td>
</tr>
<tr>
<td class="hotkey">Up or k</td>
<td class="definition">Previous message</td>