diff options
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index f7dab9f..7cea5e2 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -7195,7 +7195,7 @@ namespace QuickMedia { RoomExtraData &room_extra_data = matrix->get_room_extra_data(current_room); frame_skip_text_entry = true; chat_input.set_editable(true); - if(!room_extra_data.editing_message_id.empty()) { + if(get_config().matrix.clear_message_on_escape || !room_extra_data.editing_message_id.empty()) { chat_input.set_text(""); room_extra_data.editing_message_id.clear(); } @@ -7290,7 +7290,7 @@ namespace QuickMedia { chat_state = ChatState::REPLYING; currently_operating_on_item = selected; chat_input.set_editable(true); - if(!room_extra_data.editing_message_id.empty()) { + if(get_config().matrix.clear_message_on_escape || !room_extra_data.editing_message_id.empty()) { chat_input.set_text(""); room_extra_data.editing_message_id.clear(); } @@ -7329,7 +7329,7 @@ namespace QuickMedia { chat_state = ChatState::EDITING; currently_operating_on_item = selected; chat_input.set_editable(true); - if(chat_input.get_text().empty() || room_extra_data.editing_message_id.empty() || message->event_id != room_extra_data.editing_message_id) { + if(get_config().matrix.clear_message_on_escape || chat_input.get_text().empty() || room_extra_data.editing_message_id.empty() || message->event_id != room_extra_data.editing_message_id) { chat_input.set_text(std::move(body_text_unformatted)); // TODO: Description? it may change in the future, in which case this should be edited } chat_input.move_caret_to_end(); @@ -7463,6 +7463,8 @@ namespace QuickMedia { if(mention.visible) { mention.hide(); } else { + if(get_config().matrix.clear_message_on_escape) + chat_input.set_text(""); chat_input.set_editable(false); chat_state = ChatState::NAVIGATING; currently_operating_on_item = nullptr; @@ -7536,7 +7538,12 @@ namespace QuickMedia { if(selected_files.empty()) { if(chat_state == ChatState::REPLYING) chat_input.set_editable(true); - } else { + } else if(get_config().matrix.clear_message_on_escape) { + mention.hide(); + chat_input.set_editable(false); + chat_input.set_text(""); + chat_state = ChatState::NAVIGATING; + currently_operating_on_item = nullptr; if(typing && current_room) { fprintf(stderr, "Stopped typing\n"); typing = false; @@ -7988,7 +7995,8 @@ namespace QuickMedia { } chat_page_end: - matrix->get_room_extra_data(current_room).chat_message = chat_input.get_text(); + if(!get_config().matrix.clear_message_on_escape) + matrix->get_room_extra_data(current_room).chat_message = chat_input.get_text(); matrix_chat_page->set_current_room(nullptr, nullptr, nullptr); fetch_messages_future.cancel(); cleanup_tasks(); |