Skip to content

feat(app): sort file listings by table headers - #243

Open
loooinfo wants to merge 2 commits into
TooonyChen:mainfrom
loooinfo:feature/file-table-sort
Open

loooinfo wants to merge 2 commits into
TooonyChen:mainfrom
loooinfo:feature/file-table-sort

Conversation

@loooinfo

@loooinfo loooinfo commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

The SFTP file table gains clickable Name, Size, Type, Modified and Permissions headers using MyGo's existing sorting API. Click the active column to reverse direction or another column to start ascending. Directories stay first, sizes/timestamps/permissions use their numeric values, type uses the current localized label, and equal values use complete name ties. Selection, keyboard cursor, refresh and rename/reveal follow names; sort choices stay independent per session.

The sorting audit also fixes excessive UI-thread work for large mixed-case directories. Folded text keys are computed once per row, lightweight indices are sorted, and ordered entries are copied back into the original slice to preserve reveal's shared-slice semantics. Median 100,000-row name sorting improves from 1,946.703 ms / 213.370 MB allocated to 190.305 ms / 16.810 MB over three runs. Sorting stays synchronous and uses O(n) scratch storage, including for numeric columns. Bilingual behavior/development docs and the existing header screenshots are included.

Closes #242

Testing

  • The old PR commit fails TestFileSortAuditAllocationGrowth: 1,000 rows allocate 28,138 objects against a 4,100 budget. The fixed regression passes without a wall-clock threshold.
  • Seven additional audit tests cover allocation growth, int64/time/permission boundaries, all 120 five-row permutations in ten column/direction combinations, refresh plus Shift anchoring, cursor removal plus Enter/Down, actual SFTP rename/reveal beyond the virtual viewport plus F2, and header dragging. Existing header clicks, localized types, links, selection, refresh and session isolation tests pass. All 12 sorting-focused race tests pass.
  • Combined file/editor/sorting/folder-following/link/reconnect race regression passes 33 top-level tests; six-feature integration passes 29 relevant tests. Its 169 production Go files match the combined sources. Go vet, MyGo vet, formatting and diff checks pass in all three worktrees; merge check against upstream main 78c2f91 passes.
  • Independent go test -race ./... -count=1 -timeout 20m completes: app has 341 passing, 16 skipped and only the three failures already reproduced on unchanged upstream (TestBackgroundImage, TestBackgroundReadsOffUIThread, TestCommandBarPage). Other packages pass or have no tests. No races, timeouts or unfinished tests.
  • Three samples each benchmark 10,000 and 100,000 shuffled mixed-case entries for Name and Size, excluding row generation and remote I/O. Name sorting is about 10x faster with about 92% fewer allocated bytes at 100,000 rows. Numeric columns now share O(n) scratch storage, so this does not claim reduced allocations in every column or fully asynchronous sorting.
  • Reviewed all six existing bilingual Size/Type/Permissions screenshots; no visual changes were required. Windows amd64 custom 0.4.1 cross-build, ZIP/EXE version and source-patch checks pass. This independent PR preserves upstream release configuration and includes no other feature branch. Native Windows/macOS GUI and an external SSH server were not exercised; no Wine prefix was created.
English and Simplified Chinese screenshots (descending order)
Column English Simplified Chinese
Size size English size Chinese
Type type English type Chinese
Permissions perms English perms Chinese

Prepared with Codex.

This branch has not been deployed

No deployments
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.

feat(app): sort file listings by table headers

1 participant