diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index 961680aa25..bab8c73cd8 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -204,10 +204,18 @@ function process_hotkey(e) { } switch (event_name) { + case 'narrow_by_recipient': + return do_narrow_action(narrow.by_recipient); + case 'narrow_by_subject': + return do_narrow_action(narrow.by_subject); case 'narrow_private': return do_narrow_action(function (target, opts) { narrow.by('is', 'private-message', opts); }); + } + + + switch (event_name) { case 'page_up': if (viewport.at_top() && !current_msg_list.empty()) { current_msg_list.select_id(current_msg_list.first().id, {then_scroll: false}); @@ -241,6 +249,17 @@ function process_hotkey(e) { compose.set_mode('private'); respond_to_sent_message = true; return true; + case 'enter': // Enter: respond to message (unless we need to do something else) + respond_to_cursor = true; + respond_to_message({trigger: 'hotkey enter'}); + return true; + case 'reply_message': // 'r': respond to message + respond_to_cursor = true; + respond_to_message({trigger: 'hotkey'}); + return true; + case 'respond_to_author': // 'R': respond to author + respond_to_message({reply_type: "personal", trigger: 'hotkey pm'}); + return true; case 'search': search.initiate_search(); return true; @@ -249,36 +268,6 @@ function process_hotkey(e) { return true; } - - if (ui.pointer_visible()) { - // These actions act on the message under the pointer and don't make - // sense when the pointer is hidden. - switch (event_name) { - case 'narrow_by_recipient': - return do_narrow_action(narrow.by_recipient); - case 'narrow_by_subject': - return do_narrow_action(narrow.by_subject); - case 'enter': // Enter: respond to message (unless we need to do something else) - respond_to_cursor = true; - respond_to_message({trigger: 'hotkey enter'}); - return true; - case 'reply_message': // 'r': respond to message - respond_to_cursor = true; - respond_to_message({trigger: 'hotkey'}); - return true; - case 'respond_to_author': // 'R': respond to author - respond_to_message({reply_type: "personal", trigger: 'hotkey pm'}); - return true; - } - } else { - // Behavior when cursor is hidden - switch (event_name) { - case 'enter': - ui.show_pointer(true); - return true; - } - } - return false; } diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index 721ee8f1fb..e76b4304da 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -733,17 +733,8 @@ exports.stream_sidebar_currently_popped = function () { return current_stream_sidebar_elem !== undefined; }; -exports.show_pointer = function (apply_now) { +exports.show_pointer = function () { pointer_visible = true; - if (apply_now) { - // Needs a selection change to actually apply the class. Otherwise the - // next selection change makes the cursor visible. - current_msg_list.select_id(current_msg_list.selected_id()); - } -}; - -exports.pointer_visible = function () { - return pointer_visible; }; $(function () {