aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-12-16 16:07:13 +0100
committerdec05eba <dec05eba@protonmail.com>2023-12-16 16:07:13 +0100
commit7b91566f303b4afd2deeb6c893ee805e4d62fdaf (patch)
tree96d66d2f5c0bdb2396c6f19b8702c18a5de3ea54
parent87d04fdf4592a0b306852e16eb8fb68c2fd65c31 (diff)
Matrix: keep chat message when pressing esc or going back to previous page. Press ctrl+d to remove text instead (in input mode)
-rw-r--r--plugins/Matrix.hpp1
-rw-r--r--src/QuickMedia.cpp8
2 files changed, 3 insertions, 6 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 68081d8..de66481 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -238,6 +238,7 @@ namespace QuickMedia {
int notification_power_level = 50;
size_t index = 0;
std::atomic<uint64_t> gpg_decrypt_message_id = 0;
+ std::string chat_message;
private:
std::mutex user_mutex;
std::recursive_mutex room_mutex;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 99e68df..7b052f4 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -6011,6 +6011,7 @@ namespace QuickMedia {
Entry chat_input("Press i to start writing a message...", &rounded_rectangle_shader);
chat_input.set_editable(false);
chat_input.set_padding_scale(1.5f);
+ chat_input.set_text(current_room->chat_message);
struct ProvisionalMessage {
std::shared_ptr<BodyItem> body_item;
@@ -7438,7 +7439,6 @@ namespace QuickMedia {
mention.hide();
} else {
chat_input.set_editable(false);
- chat_input.set_text("");
chat_state = ChatState::NAVIGATING;
currently_operating_on_item = nullptr;
if(typing && current_room) {
@@ -7512,11 +7512,6 @@ namespace QuickMedia {
if(chat_state == ChatState::REPLYING)
chat_input.set_editable(true);
} else {
- 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;
@@ -7968,6 +7963,7 @@ namespace QuickMedia {
}
chat_page_end:
+ current_room->chat_message = chat_input.get_text();
matrix_chat_page->set_current_room(nullptr, nullptr, nullptr);
fetch_messages_future.cancel();
cleanup_tasks();