mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
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:
parent
de69036e9e
commit
0173251b22
|
@ -2522,11 +2522,7 @@ void ArticleView::receiveExpandOptionalParts( bool expand )
|
||||||
void ArticleView::switchExpandOptionalParts()
|
void ArticleView::switchExpandOptionalParts()
|
||||||
{
|
{
|
||||||
expandOptionalParts = !expandOptionalParts;
|
expandOptionalParts = !expandOptionalParts;
|
||||||
|
articleToJump = getCurrentArticle();
|
||||||
int n = getArticlesList().indexOf( getActiveArticleId() );
|
|
||||||
if( n > 0 )
|
|
||||||
articleToJump = getCurrentArticle();
|
|
||||||
|
|
||||||
emit setExpandMode( expandOptionalParts );
|
emit setExpandMode( expandOptionalParts );
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue