Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txs restores wrong top line with folded lines #3627

Merged
merged 1 commit into from
May 5, 2024

Conversation

octaeder
Copy link
Contributor

@octaeder octaeder commented May 4, 2024

Fold 13 lines (i.e. they are hidden) as shown here:

image

Then scroll down (down is the important information here) to line 253 such that this line is at top of the editor:

image

Close txs (but not the editor) and find their indices in the session file:

"FirstLine": 252,
"FoldedLines": "227",

Starting txs the editor shows at top line:

image

But we expect to see line 253 at top.

Txs calculates the position of FirstLine before lines are folded. Since 13 lines are hidden by folding, line 253+13=263 moves to top of the editor. S. QDocument::y(…) used in scrollToFirstLine, which respects folded and wrapped lines by calling visualLine.
To fix this the order of position calculation and folding need to be reversed.

@sunderme sunderme merged commit 80f3c55 into texstudio-org:master May 5, 2024
7 checks passed
@sunderme
Copy link
Member

sunderme commented May 5, 2024

thanks

@octaeder octaeder deleted the FoldLines branch May 5, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants