rampaa / JL

JL is a program for looking up Japanese words and expressions.
Apache License 2.0
198 stars 4 forks source link

Scrolling down on a popup causes the next popup to be fully scrolled down #65

Closed Mansive closed 1 year ago

Mansive commented 1 year ago

If I scroll down on a popup window, exit out of it, then click on another word to open a popup, the popup will appear from the bottom of the list instead of the top. This makes it so that I have to scroll all the way back up to see the more relevant entries. More easily observable with lookup mode "Mouse click/touch".

Mansive commented 1 year ago

I still have this issue with "Mouse click/touch" on the latest release and also encountered strange behavior when trying to reproduce it.

On a fresh install with default settings besides changing to "Mouse click/touch" and the default dictionaries installed, sometimes the next popup's scroll position successfully resets, and sometimes it doesn't and appears fully scrolled down. It feels random whether or not the scroll position resets. I can see this behavior by clicking on a word, scrolling down on popup, then clicking on a word.

However, if I click anywhere on the main window to close the scrolled popup before clicking on another word, the scroll position successfully resets to the top without fail. This trick goes away though if I enable "Highlight the longest match".

Changing the main window's height to be smaller so that part of the sentence is hidden seems to increase the chances of a successful reset when "Highlight the longest match" is disabled, but this might just be placebo.

rampaa commented 1 year ago

This issue proved to be harder than expected to fix so I will leave it open until you can confirm it is fixed for you

rampaa commented 1 year ago

The new version is out. I'd appreciate it if you could confirm whether or not the issue is fixed for you.

Mansive commented 1 year ago

The issue is fixed in that popups don't appear fully scrolled down. Some popups still have the issue but to a lesser extent by being only slightly scrolled down. It takes me a only a ticks of my scroll wheel to reach the top, which is much less annoying than before.

rampaa commented 1 year ago

Can you give the exact steps to reproduce the issue as I can't seem to reproduce it on my end any more. A video demonstrating the issue would be also helpful.

Mansive commented 1 year ago

I have made a video. The JL on top is my current one with a bunch of dictionaries and changed settings, while the bottom JL is a fresh download with default dictionaries only one setting changed (Mouse click/Touch enabled). The issue seems to repeatedly occur on the same words, and the words the issue occurs on is different between my current JL and fresh JL. Harder to reproduce on the fresh install.

https://github.com/rampaa/JL/assets/33560917/9adbe491-3be3-4904-a463-becbccf10f33

rampaa commented 1 year ago

Thanks for the video. Thanks to it, I've realized I've broken the UI virtualization (that's why it takes that long for a popup to appear in the video) while trying to solve this issue.

A new release is out that fixes the UI virtualization and (hopefully) this issue. I'm still having a hard time reproducing this issue on my end so I would appreciate it if you could tell me whether or not it's fixed for you.

Mansive commented 1 year ago

The popups do appear very fast now! And the issue is now harder to reproduce on both my current and fresh install, for example not happening often with "かゆいところにてがとどく" anymore (found the issue easy to trigger with that phrase), but it has returned to being fully scrolled down instead of slightly scrolled down. I also have a different recording of a popup being slightly scrolled down, but the chances of that occurring are extremely low.

https://github.com/rampaa/JL/assets/33560917/47a46436-190d-4f3e-a714-4e377dd09c2f

rampaa commented 1 year ago

it has returned to being fully scrolled down instead of slightly scrolled down

The underlying bug (which seems like a WPF bug rather than a JL bug at this point) causes it to be fully scrolled down when UI virtualization is in effect, when it isn't it only causes it to be slightly scrolled down. If I didn't care about UI virtualization, I think I could easily fix this problem by not using ListView's inner ScrollViewer at all but that's not really an option because the performance impact of not having UI virtualization is way too huge.

I imagine this is rather annoying for you at this point but I'd appreciate it if you could bear with me a little bit longer. I've tried a few different approaches but I don't know if any of them actually fixes the problem, can you try them out and tell me which one of those (if any) fixes the problem for you?

1.zip 2.zip 3.zip 4.zip 5.zip

Mansive commented 1 year ago

I haven't extensively tested them with different settings and more dictionaries, but from about ~10 minutes with each I haven't been able to reproduce the issue at all. Or I might have but didn't notice because I spaced out, but I think all five have fixed the issue.

rampaa commented 1 year ago

Nice! Thanks for testing them!

(The greater the number in the file name the cruder the fix was. 5.zip was basically waiting for 100 ms before scrolling it back to top after the popup becomes visible. So if all of them fix the issue I will just go with the first solution.)

Mansive commented 1 year ago

Sorry to revive this issue once more, I updated my current JL to the latest version and found that the issue is still happening. However, I then tested a fresh install of the latest version where I downloaded default dictionaries then opened up and scrolled down 100 popups, but I didn't encounter the issue.

I figured the biggest difference between my current JL and fresh JL was the dictionaries, so I tried messing around with them. I discovered that if I turn every dictionary off except the Edewakaru grammar dictionary, the chances of the issue occurring skyrocket to the point where I can trigger it every ~7 popups or so. Testing each of the other grammar dictionaries alone also yielded similar occurrence chances. After that, I tested the normal dictionaries like Daijisen and Oubunsha on their own, and it took 20-80 popups before the issue happened, much more compared to the grammar dictionaries. The default JMDict was the only dictionary where I couldn't reproduce the issue even after 100 popups.

Next, I decided to test each of the 5 zip files with Edewakaru as the only dictionary turned on. Didn't try with other dictionaries to save time. The zip files where the issue didn't happen even after 100 popups were 3.zip, 4.zip, and 5.zip.

rampaa commented 1 year ago

Thanks for your detailed tests! Can you test which of the following builds fix the problem for you? (Just trying to figure out what's the minimum action required to fix this issue.)

6.zip 7.zip 8.zip

Mansive commented 1 year ago

Tested 6.zip. Did 200 popups each with JMdict alone, Edewakaru alone, and my whole dictionary collection for a total of 600 popups. Couldn't reproduce the issue.

rampaa commented 1 year ago

Thanks! Here's the last build I need you to test so that I can find the optimal fix:

9.zip

Please let me know whether or not you can reproduce the issue with it. If you can reproduce the issue with 9.zip, the optimal fix that actually works is the one found in 6.zip, if you can't reproduce the issue with it then the fix found in 9.zip is the optimal one.

Mansive commented 1 year ago

600+ popups, can't reproduce with 9.zip.

rampaa commented 1 year ago

Thank you so much for the help.

(The fix found in 9.zip was already committed to the master branch in https://github.com/rampaa/JL/commit/09a2e4f479e588bb2c5b6c168d175469fec12668, so I just released the new version without needing to create any additional commits to address this issue.)