Merge pull request #835 from glowing-bear/alth

Implement alt-h. Fixes #832
This commit is contained in:
Lorenz Hübschle-Schneider 2016-11-09 14:34:54 +01:00 committed by GitHub
commit 8892c4dfe5
3 changed files with 16 additions and 0 deletions

View File

@ -151,6 +151,7 @@
<li><kbd>ALT-a</kbd>: Focus on next buffer with activity</li>
<li><kbd>ALT-&lt;</kbd>: Switch to previous active buffer</li>
<li><kbd>ALT-g</kbd>: Focus on buffer list filter</li>
<li><kbd>ALT-h</kbd>: Clear unread counters in every buffer (locally)</li>
<li><kbd>Esc-Esc</kbd>: Disconnect (double-tap)</li>
<li>Arrow keys: Navigate history, or navigate quick search buffer results.</li>
<li><kbd>Tab</kbd>: Complete nick</li>

View File

@ -420,6 +420,10 @@ weechat.factory('connection',
}
};
var sendHotlistClearAll = function() {
sendMessage("/input hotlist_clear");
};
var requestNicklist = function(bufferId, callback) {
// Prevent requesting nicklist for all buffers if bufferId is invalid
if (!bufferId) {
@ -513,6 +517,7 @@ weechat.factory('connection',
sendMessage: sendMessage,
sendCoreCommand: sendCoreCommand,
sendHotlistClear: sendHotlistClear,
sendHotlistClearAll: sendHotlistClearAll,
fetchMoreLines: fetchMoreLines,
requestNicklist: requestNicklist,
attemptReconnect: attemptReconnect

View File

@ -357,6 +357,16 @@ weechat.directive('inputBar', function() {
return true;
}
// Alt-h -> Toggle all as read
if ($event.altKey && !$event.ctrlKey && code === 72) {
var buffers = models.getBuffers();
_.each(buffers, function(buffer) {
buffer.unread = 0;
buffer.notification = 0;
});
connection.sendHotlistClearAll();
}
var caretPos;
// Arrow up -> go up in history