From 0173251b2277173f36eca36e9c2ce137caba3c52 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Sat, 11 Jun 2022 20:37:50 +0300 Subject: [PATCH] Jump to the first article too after expanding optional parts When the first article in the list is current, expanding or collapsing optional parts results in: 1) uncontrolled jumps due to the content height changes if the scroll position is not (0, 0); 2) current article change if a non-first article is saved in history user data (e.g. if a mouse click had made the first article active). Treat the first current article in the same way as non-first ones. This change also affects the case when the current article is not present in the article list. If the current article is simply empty, then there is no behavior change. If the current article is not empty, it *must* be in the list, unless something else went wrong. --- articleview.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/articleview.cc b/articleview.cc index eb7f2e04..80d94913 100644 --- a/articleview.cc +++ b/articleview.cc @@ -2522,11 +2522,7 @@ void ArticleView::receiveExpandOptionalParts( bool expand ) void ArticleView::switchExpandOptionalParts() { expandOptionalParts = !expandOptionalParts; - - int n = getArticlesList().indexOf( getActiveArticleId() ); - if( n > 0 ) - articleToJump = getCurrentArticle(); - + articleToJump = getCurrentArticle(); emit setExpandMode( expandOptionalParts ); reload(); }