hotkeys: Add "p" to narrow to next unread PM thread.

This works simimlar to the "n" key for next topics.

This commit does a few things:

    * It wires up the hotkey to an existing function
      that could change narrows.
    * It adds documentation.
    * It adds logic to make sure the compose box does
      not open.

@showell helped a bit with the wording of comments here.

Fixes #4874
This commit is contained in:
Abhigyan Khaund
2018-02-16 20:26:25 +05:30
committed by Steve Howell
parent 68664acf1f
commit a75f0aa594
6 changed files with 33 additions and 4 deletions

View File

@@ -384,7 +384,17 @@ exports.quote_and_reply = function (opts) {
});
};
exports.on_narrow = function () {
exports.on_narrow = function (opts) {
// We use force_close when jumping between PM narrows with the "p" key,
// so that we don't have an open compose box that makes it difficult
// to cycle quickly through unread messages.
if (opts.force_close) {
// This closes the compose box if it was already open, and it is
// basically a noop otherwise.
exports.cancel();
return;
}
if (narrow_state.narrowed_by_topic_reply()) {
exports.on_topic_narrow();
return;