hotkeys: Move copy_with_c shortcut definition and improve comments.

The `copy_handler` function that this shortcut calls is not useful
unless the body of a Zulip message is selected, so we shouldn't try
running it in other situations.
This commit is contained in:
Tim Abbott
2021-04-04 17:58:18 -07:00
committed by Tim Abbott
parent 4462df64da
commit e7e2340eda

View File

@@ -759,7 +759,7 @@ export function process_hotkey(e, hotkey) {
return false;
}
// Compose box hotkeys
// Shortcuts that are useful with an empty message feed, like opening compose.
switch (event_name) {
case "compose": // 'c': compose
compose_actions.start("stream", {trigger: "compose_hotkey"});
@@ -781,16 +781,14 @@ export function process_hotkey(e, hotkey) {
case "star_deprecated":
ui.maybe_show_deprecation_notice("*");
return true;
case "copy_with_c":
copy_and_paste.copy_handler();
return true;
}
if (message_lists.current.empty()) {
return false;
}
// Navigation shortcuts
// Shortcuts for navigation and other applications that require a
// nonempty message feed but do not depend on the selected message.
switch (event_name) {
case "down_arrow":
case "vim_down":
@@ -817,6 +815,9 @@ export function process_hotkey(e, hotkey) {
case "spacebar":
navigate.page_down();
return true;
case "copy_with_c":
copy_and_paste.copy_handler();
return true;
}
const msg = message_lists.current.selected_message();