eric-bixby / auto-sort-bookmarks-webext

Firefox add-on to sort bookmarks by multiple criteria
GNU General Public License v3.0
112 stars 21 forks source link

Separators Ignored (or Randomly Moving) #56

Open Taurean75 opened 6 years ago

Taurean75 commented 6 years ago

As it is now (3.0), separators are being ignored. Please correct this.

Thanks.

eric-bixby commented 6 years ago

OK, I was able to reproduce the bug.

eric-bixby commented 6 years ago

I'm seeing weird things with separators. There might be a bug in Firefox. This needs more testing.

Taurean75 commented 6 years ago

Take a look at https://addons.mozilla.org/en-US/firefox/addon/sort-bookmarks-webext/

That developer fixed it quite quickly.

eric-bixby commented 6 years ago

Actually, separators are not being ignored. What I'm seeing is that the separator randomly moves, which causes the sorting to change. This is why I think it might be a Firefox issue.

Taurean75 commented 6 years ago

I concur. Personally, issue #54 is more urgent.

TimidScript commented 6 years ago

It destroyed my bookmark order on several profiles before I realised it. Hope to see it fixed soon.

As to "Sort Bookmarks" by heftig that one does not even sort alphabetically correctly. Not sure why that is happening though.

akwala commented 6 years ago

I noticed that the issue with the separator occurs when moving bookmarks across separators. Folders in which bookmarks are not moved retain the state of their separators and sort correctly.

After unchecking 'Auto sort' pref of the addon (and saving the prefs), I added separators in a folder and grouped the bookmarks in it by moving them across the separators. The bookmarks between the separators were not sorted. I then checked 'Auto sort' (and saved). Within seconds the bookmarks in the folder got sorted correctly, with the separators intact.

Then, with 'Auto sort' still checked, I added a bookmark in the folder, which got appended at the bottom as expected. This time 10+ minutes passed before the bookmarks got auto-sorted, but the sorting was correct and the separators remained intact.

eric-bixby commented 6 years ago

@akwala Thanks for the report. Here's what I'm seeing when existing bookmarks are moved either above or below (across) a separator, while auto-sort is enabled, the net result is the separator ends up getting moved to the top and the bookmarks below. I also noticed this doesn't always happen and appears to be timed based which makes me wonder if there might be a cache problem. It's going to take more debugging to narrow down. I'll look into this once I finish the exclude-folders feature.

eric-bixby commented 5 years ago

(btw, I haven't forgotten about this issue.)

The problem appears to be auto-sort sorting while a bookmark is being dragged.

There are two possible workarounds: 1) disable auto-sort while moving. 2) increase the preference to wait before auto sorting.

It would be nice if FF told me when a bookmark is being dragged, but I'm not aware of an API for this. My next step will be to search for such an API. If not, then I don't have an alternative and I'm open to suggestions.

akwala commented 5 years ago
1. disable auto-sort while moving.

If auto-sort and changes outside auto-sort can be made never to overlap then this seems better because it does not depend on a user preference. However, if this requires significant additional coding, it may not be worth introducing more complexity and bug possibilities if the second option is adequate.

2. increase the preference to wait before auto sorting.

This could be adequate. It might help to increase the lower limit to, say, 30 seconds. I can't think of a reason to have as short a wait as the current minimum of 5 sec. The maximum of 255 sec, or 4.25 minutes, should be fine though a higher max would be useful if one is doing a substantial reorg of one's bookmarks.

I've enabled auto-sort with an inactivity wait of 180 sec (3 min). I'll report back on how that goes.

Update: With inactivity wait of 180 sec auto-sort doesn't happen immediately but, when it does, bookmarks and separators end up in positions other than those set:

Wizardgoat commented 1 year ago

Here's what I'm seeing. I have a folder with many bookmarks in the section following the last separator, At one point I created a new separator above it, and moved about half the bookmarks to the section above the separator. I noticed a few stragglers stayed in the bottom section, so had to move them again.

But here's the weird symptom I've noticed since. I'll save a new bookmark, which FF puts in the bottom section as expected. I then drag it up above the separator, and it stays. But one bookmark already above the separator jumps down to the bottom section. I then drag the latter bookmark up, but the first bookmark jumps down. I keep dragging "A" and "B" up, but the other jumps back. The only way I can circumvent this is to turn off the extension while doing a move, which forces me to sort visually.

If I create another bookmark "C" and drag it up, then either "A" or "B" will jump back down. It seems that the same couple of bookmarks are the ones most often affected.

I wish this problem could be prioritized. I see that it was reported a few versions back, and it is quite irritating,

Wizardgoat commented 1 year ago

I apparently found a work-around. I inserted a new separator just above the one that was sometimes being ignored. I tried adding a bookmark to the bottom section, and no problem occurred. Then I deleted the original separator, and experimented with more bookmarks. The problem seems to have cleared up. Apparently the original separator was somehow "poisoned" and porous to some bookmarks, But the new separator seems to be "solid".

blackwind commented 1 year ago

I'm unable to get the add-on working with any combination of new or old separators, folders containing other folders or not. Output is seemingly random -- sometimes it sorts the separator to the bottom, sometimes it tosses it in the middle for no reason, but it never does what you'd expect. Can you take another look at this, Eric?

Wizardgoat commented 1 year ago

I think you've diagnosed it by acknowledging that the failure (or lack) is random, with each separator created. I've circumvented it by creating a new separator above the bad one, and then deleting the bad one. But while this often works, it doesn't fix the problem. Good luck on an eventual solution.

Gitoffthelawn commented 1 year ago

I have no idea if it's relevant here, but whenever I see an issue report involving sorted items moving randomly, the cause is often due to an artifact of how the sort algorithm handles equally weighted items.

For example, if you alphabetically (case-insensitive) sort the following list:

apple
cherry
Banana
banana

a valid result can be either:

apple
Banana
banana
cherry

or

apple
banana
Banana
cherry

If the code doesn't handle equally-weighted items with consistency, the bananas can sometimes shift position during sorting, which appears random to the user.

Again, I have no idea if this helps explain what is going on here, but I've seen it enough times with other code that I thought it worthwhile to take the time to write this post.

eric-bixby commented 1 year ago

It’s been awhile but list time I checked, it was a timing issue. When I did a drag-n-drop, it started sorting before I dropped.

I need to run some tests.

On Fri, Jan 20, 2023 at 6:57 PM Gitoffthelawn @.***> wrote:

I have no idea if it's relevant here, but whenever I see an issue report involving sorted items moving randomly, the cause is often due to an artifact of how the sort algorithm handles equally weighted items.

For example, if you alphabetically (case-insensitive) sort the following list:

apple cherry Banana banana

a valid result can be either:

apple Banana banana cherry

or

apple banana Banana cherry

If the code doesn't handle equally-weighted items with consistency, the bananas can sometimes shift position during sorting, which appears random to the user.

Again, I have no idea if this helps explain what is going on here, but I've seen it enough times with other code that I thought it worthwhile to take the time to write this post.

— Reply to this email directly, view it on GitHub https://github.com/eric-bixby/auto-sort-bookmarks-webext/issues/56#issuecomment-1399159911, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGRCMPOH4HC2E3P3DQPQI3WTNGBZANCNFSM4EFL4YNA . You are receiving this because you were assigned.Message ID: @.***>

Gitoffthelawn commented 1 year ago

Makes sense too!