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

Desktop: Fix Goto scrolling (#2122) #2199

Merged
merged 3 commits into from
Dec 28, 2019
Merged

Conversation

rc2dev
Copy link
Contributor

@rc2dev rc2dev commented Dec 18, 2019

Fix issue #2122

Copy link
Collaborator

@tessus tessus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. I've tested it on macOS. I'm just wondering why the removed code was there in the first place.

@laurent22 do you remember why that code was there?

I can only say that removing those 2 lines fixes the problem.

@laurent22
Copy link
Owner

The original code makes sense to me: if the note is already visible, there's no need to scroll. So I don't think we can remove this part but rather we should find out why a valid index if outside of bounds. @rccavalcanti, do you know what could be the issue?

@rc2dev
Copy link
Contributor Author

rc2dev commented Dec 18, 2019

I dove a bit more on that line and found it just has a problem in the boundaries:

So I brought the line back and fixed it.

Edit: Clarification.

Copy link
Collaborator

@tessus tessus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it on macOS. Your fix works! 👍

@tessus tessus added the desktop All desktop platforms label Dec 18, 2019
@rc2dev
Copy link
Contributor Author

rc2dev commented Dec 18, 2019

Great! Just don't merge yet. I'm working in a better fix.

@rc2dev
Copy link
Contributor Author

rc2dev commented Dec 18, 2019

So previously, I found that bottom and top were 1-based, while itemIndex was 0-based. This ultimately caused the boundary problem. I solved it in 62674dc, resting 1 from them.

However, I thought this was probably unintended and all values should be 0-based. So I went to investigate further.

It turns out that I found 2 different bugs in the class that caused the 1-based index:

  • for bottom, it was in the definition of bottomItemIndex
  • for top, it was in its own definition

So I fixed both and kept the line of conditional return unchanged.

I think this is much cleaner and probably the final solution. Sorry for the multiple iterations!

@tessus
Copy link
Collaborator

tessus commented Dec 21, 2019

@laurent22 is anything still missing?

@laurent22
Copy link
Owner

Perfect thanks @rccavalcanti and @tessus!

@laurent22 laurent22 merged commit c8a0138 into laurent22:master Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants