Merge pull request #167 from tribut/mimic-go-py

Make buffer filter more keyboard friendly
This commit is contained in:
David Cormier 2014-02-21 08:44:51 -05:00
commit 02e79ade4e
2 changed files with 9 additions and 7 deletions

View file

@ -108,12 +108,12 @@
<h3>Shortcuts</h3> <h3>Shortcuts</h3>
Glowing Bear has a few shortcuts: Glowing Bear has a few shortcuts:
<ul> <ul>
<li>ALT+n: Toggle nicklist</li> <li>ALT-n: Toggle nicklist</li>
<li>ALT+l: Focus on input bar</li> <li>ALT-l: Focus on input bar</li>
<li>ALT-[0-9]: Focus on buffer</li> <li>ALT-[0-9]: Focus on buffer</li>
<li>ALT-a: Focus on next buffer with activity</li> <li>ALT-a: Focus on next buffer with activity</li>
<li>ALT-<: Switch to previous buffer</li> <li>ALT-<: Switch to previous buffer</li>
<li>CTRL+G: Focus on buffer list filter</li> <li>ALT-g: Focus on buffer list filter</li>
<li>escape: disconnect</li> <li>escape: disconnect</li>
<li>arrow keys: history navigation</li> <li>arrow keys: history navigation</li>
</ul> </ul>
@ -279,7 +279,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
<input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search"> <input class="form-control monospace" type="text" id="bufferFilter" ng-model="search" ng-keydown="handleSearchBoxKey($event)" placeholder="Search">
</form> </form>
</li> </li>
<li class="buffer" ng-class="{'active': content.active, 'indent': content.indent }" ng-repeat="(key, content) in buffers | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:predicate"> <li class="buffer" ng-class="{'active': content.active, 'indent': content.indent }" ng-repeat="(key, content) in (filteredBuffers = (buffers | toArray | filter:{fullName:search} | filter:hasUnread | orderBy:predicate))">
<a href="#" ng-click="setActiveBuffer(content.id)" title="{{ content.fullName }}"> <a href="#" ng-click="setActiveBuffer(content.id)" title="{{ content.fullName }}">
<span class="badge pull-right" ng-hide="content.notification" ng-if="content.unread" ng-bind="content.unread"></span> <span class="badge pull-right" ng-hide="content.notification" ng-if="content.unread" ng-bind="content.unread"></span>
<span class="badge pull-right danger" ng-show="content.notification" ng-bind="content.notification"></span> <span class="badge pull-right danger" ng-show="content.notification" ng-bind="content.notification"></span>

View file

@ -856,7 +856,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
} // Handle enter } // Handle enter
else if (code === 13) { else if (code === 13) {
$event.preventDefault(); $event.preventDefault();
// TODO Switch to first matching buffer and reset query if ($scope.filteredBuffers.length > 0) {
models.setActiveBuffer($scope.filteredBuffers[0].id);
}
$scope.search = ''; $scope.search = '';
} }
}; };
@ -1056,8 +1058,8 @@ weechat.directive('inputBar', function() {
return true; return true;
} }
// Ctrl+G -> focus on buffer filter input // Alt+G -> focus on buffer filter input
if ($event.ctrlKey && (code === 103 || code === 71)) { if ($event.altKey && (code === 103 || code === 71)) {
$event.preventDefault(); $event.preventDefault();
document.getElementById('bufferFilter').focus(); document.getElementById('bufferFilter').focus();
return true; return true;