aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 74ee75e..2e1eac3 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2824,6 +2824,7 @@ namespace QuickMedia {
sf::Event event;
std::stack<int> comment_navigation_stack;
+ std::stack<int> comment_page_scroll_stack;
while (current_page == Page::IMAGE_BOARD_THREAD) {
while (window.pollEvent(event)) {
@@ -2898,17 +2899,19 @@ namespace QuickMedia {
body->items[reply_index]->visible = true;
}
comment_navigation_stack.push(body->get_selected_item());
+ comment_page_scroll_stack.push(body->get_page_scroll());
+ body->clamp_selection();
} else if(event.key.code == sf::Keyboard::BackSpace && !comment_navigation_stack.empty()) {
- size_t previous_selected = 0;
- if(!comment_navigation_stack.empty()) {
- previous_selected = comment_navigation_stack.top();
- }
+ size_t previous_selected = comment_navigation_stack.top();
+ float previous_page_scroll = comment_page_scroll_stack.top();
comment_navigation_stack.pop();
+ comment_page_scroll_stack.pop();
if(comment_navigation_stack.empty()) {
for(auto &body_item : body->items) {
body_item->visible = true;
}
body->set_selected_item(previous_selected);
+ body->clamp_selection();
} else {
for(auto &body_item : body->items) {
body_item->visible = false;
@@ -2919,7 +2922,9 @@ namespace QuickMedia {
for(size_t reply_index : selected_item->replies) {
body->items[reply_index]->visible = true;
}
+ body->clamp_selection();
}
+ body->set_page_scroll(previous_page_scroll);
} else if(event.key.code == sf::Keyboard::C && event.key.control && selected_item) {
navigation_stage = NavigationStage::REPLYING;
} else if(event.key.code == sf::Keyboard::R && selected_item) {