hotkey: Rename confusingly named is_editing_stream_name.

The feature is used for editing stream descriptions as well, and in
any case, what's important is that it's a content-editable widget (aka
a form of input box).
This commit is contained in:
Tim Abbott 2020-01-29 11:22:07 -08:00
parent c103cf69ff
commit 6b79448e01
2 changed files with 7 additions and 7 deletions

View File

@ -182,7 +182,7 @@ run_test('basic_chars', () => {
// We have to skip some checks due to the way the code is
// currently organized for mapped keys.
hotkey.is_editing_stream_name = return_false;
hotkey.in_content_editable_widget = return_false;
overlays.settings_open = return_false;
set_global('popovers', {
@ -409,10 +409,10 @@ run_test('motion_keys', () => {
assert_mapping('right_arrow', 'lightbox.next');
overlays.lightbox_open = return_false;
hotkey.is_editing_stream_name = return_true;
hotkey.in_content_editable_widget = return_true;
assert_unmapped('down_arrow');
assert_unmapped('up_arrow');
hotkey.is_editing_stream_name = return_false;
hotkey.in_content_editable_widget = return_false;
overlays.settings_open = return_true;
assert_unmapped('end');

View File

@ -170,7 +170,7 @@ exports.processing_text = function () {
$focused_elt.attr("id") === "compose-send-button";
};
exports.is_editing_stream_name = function (e) {
exports.in_content_editable_widget = function (e) {
return $(e.target).is(".editable-section");
};
@ -178,7 +178,7 @@ exports.is_editing_stream_name = function (e) {
exports.process_escape_key = function (e) {
let row;
if (exports.is_editing_stream_name(e)) {
if (exports.in_content_editable_widget(e)) {
return false;
}
@ -311,7 +311,7 @@ exports.process_enter_key = function (e) {
return true;
}
if (exports.is_editing_stream_name(e)) {
if (exports.in_content_editable_widget(e)) {
$(e.target).parent().find(".checkmark").click();
return false;
}
@ -511,7 +511,7 @@ exports.process_hotkey = function (e, hotkey) {
return subs.switch_rows(event_name);
}
if (exports.is_editing_stream_name(e)) {
if (exports.in_content_editable_widget(e)) {
// We handle the enter key in process_enter_key().
// We ignore all other keys.
return false;