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

fix: bottom view line in overview is now calculated correctly. #707

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

s-g-stavely
Copy link

I noticed that when viewing files, the "view lines" shown on the overview did not line up with the actual lines that were being viewed. Instead, one of the lines would always remain near the top of the file.

This is because this change added some extra brackets to Overview::getViewLines() that changed the order of operations in the calculation of bottom. I've fixed up the order of operations for this calculation.

Original working code:
bottom = (int)((qint64)top + nbLines_.get() * height_ / linesInFile_.get());

Code with incorrect order of operations:
bottom = static_cast<int>( ( static_cast<unsigned>( top ) + nbLines_.get() ) * height_ / ( linesInFile_.get() ) );

Fixed code:
bottom = top + static_cast<int>( nbLines_.get() * height_ / ( linesInFile_.get() ) );

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

1 participant