aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp2
-rw-r--r--src/QuickMedia.cpp28
2 files changed, 17 insertions, 13 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index f9b3edc..ee32b08 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -698,7 +698,7 @@ namespace QuickMedia {
sf::String replies_text_str;
for(size_t reply_index : item->replies) {
BodyItem *reply_item = items[reply_index].get();
- replies_text_str += ">>";
+ replies_text_str += " >>";
replies_text_str += reply_item->post_number;
}
replies_text.setString(std::move(replies_text_str));
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 7a95ee6..046ba9d 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2384,7 +2384,7 @@ namespace QuickMedia {
}, is_tor_enabled());
};
- Entry comment_input("Press ctrl+m to begin writing a comment...", font.get(), cjk_font.get());
+ Entry comment_input("Press m to begin writing a comment...", font.get(), cjk_font.get());
comment_input.draw_background = false;
comment_input.set_editable(false);
@@ -2481,7 +2481,7 @@ namespace QuickMedia {
if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus)
redraw = true;
- else if(event.type == sf::Event::KeyPressed && navigation_stage == NavigationStage::VIEWING_COMMENTS) {
+ else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == sf::Event::KeyPressed) {
if(event.key.code == sf::Keyboard::Up) {
thread_body->select_previous_item();
} else if(event.key.code == sf::Keyboard::Down) {
@@ -2564,15 +2564,15 @@ namespace QuickMedia {
thread_body->clamp_selection();
}
thread_body->set_page_scroll(previous_page_scroll);
- } else if(event.key.code == sf::Keyboard::M && event.key.control && selected_item) {
- navigation_stage = NavigationStage::REPLYING;
- comment_input.set_editable(true);
- comment_input.move_caret_to_end();
} else if(event.key.code == sf::Keyboard::R && selected_item) {
std::string text_to_add = ">>" + selected_item->post_number + "\n";
comment_input.append_text(std::move(text_to_add));
comment_input.move_caret_to_end();
}
+ } else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::M) {
+ navigation_stage = NavigationStage::REPLYING;
+ comment_input.set_editable(true);
+ comment_input.move_caret_to_end();
}
if(event.type == sf::Event::KeyPressed && navigation_stage == NavigationStage::SOLVING_POST_CAPTCHA) {
@@ -2887,15 +2887,19 @@ namespace QuickMedia {
return str;
}
+ static std::string message_get_body_remove_formatting(Message *message) {
+ if(message->related_event_type == RelatedEventType::REPLY || message->related_event_type == RelatedEventType::EDIT)
+ return remove_reply_formatting(message->body);
+ else
+ return message->body;
+ }
+
static const sf::Vector2i CHAT_MESSAGE_THUMBNAIL_MAX_SIZE(600, 337);
static std::shared_ptr<BodyItem> message_to_body_item(Message *message, UserInfo *me) {
auto body_item = BodyItem::create("");
body_item->set_author(message->user->display_name);
- std::string text = message->body;
- if(message->related_event_type == RelatedEventType::REPLY)
- text = remove_reply_formatting(text);
- body_item->set_description(std::move(text));
+ body_item->set_description(message_get_body_remove_formatting(message));
body_item->set_timestamp(message->timestamp);
if(!message->thumbnail_url.empty()) {
body_item->thumbnail_url = message->thumbnail_url;
@@ -3153,7 +3157,7 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION || message->related_event_type == RelatedEventType::EDIT) {
auto body_item = find_body_item_by_event_id(body_items, num_body_items, message->related_event_id);
if(body_item) {
- body_item->set_description(message->body);
+ body_item->set_description(message_get_body_remove_formatting(message.get()));
if(message->related_event_type == RelatedEventType::REDACTION)
set_body_as_deleted(message.get(), body_item.get());
it = unreferenced_events.erase(it);
@@ -3175,7 +3179,7 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION || message->related_event_type == RelatedEventType::EDIT) {
auto body_item = find_body_item_by_event_id(body_items.data(), body_items.size(), message->related_event_id);
if(body_item) {
- body_item->set_description(message->body);
+ body_item->set_description(message_get_body_remove_formatting(message.get()));
if(message->related_event_type == RelatedEventType::REDACTION)
set_body_as_deleted(message.get(), body_item.get());
} else {