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.
This commit is contained in:
Igor Kushnir 2022-06-11 20:37:50 +03:00 committed by Abs62
parent de69036e9e
commit 0173251b22

View file

@ -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();
}