Skip to content

Unintuitive natural sorting behavior #223

@UncraftedName

Description

@UncraftedName

Using v0.6.8 with ImGuiFileDialogFlags_NaturalSorting.

Issue 1: always put '..' first

I saw #118, but it's still very much a problem. Specifically:

  • if you click on 'File name' so that the sorting is descending that makes '..' appear at the end
  • '..' appears after numerical folders/files (when the sorting is ascending)
Image Image

I see that '..' is passed to IGFD::Utils::NaturalCompare which leads to incorrect sorting behavior - there should be a special case for '..' somewhere.

Issue 2: incorrect behavior for numerical values separate by '.'

The '.' character should not be parsed in M_ExtractNumFromStringAtPos.

In this case the last part of the file name is ignored:

Image Image

In this case the second part of the file name is not correctly sorted:

Image

Issue 3: only one file has an additional suffix before the extension

This one is a less significant issue than the others - it's based off of how I see files in windows. I understand that the natural sorting is not necessarily made to copy the behavior of windows.

Here is a collection of files sorted in windows:

Image

The same files when viewed in ImGuiFileDialog:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions