mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 23:20:18 +01:00
8eb2fd211f
## Problem Column filter dropdown options in `tabular_data_preview` were sorted with standard lexicographical comparison (`a.content.cmp(&b.content)`). This led to unnatural ordering for numbers and mixed alphanumeric values (e.g., `"item 10"` sorting before `"item 2"`). ## Solution Switched to `util::paths::natural_sort` based comparison: - Compares numeric segments by numerical value rather than lexicographically (e.g., `1`, `2`, `10` instead of `1`, `10`, `2`). - Performs case-insensitive comparison with case-sensitive tie-breaking. - Keeps `None`/null values sorted at the bottom of the filter list. ## Testing - Added unit tests in `table_header.rs` covering numeric runs, case insensitivity, and null value placement. - `cargo test -p tabular_data_preview` - `./script/clippy -p tabular_data_preview` clean. ## Showcase | Before | After | | --- | --- | | <img width="578" height="617" alt="image" src="https://github.com/user-attachments/assets/4d74a8d0-6364-4ef6-b659-d36350e02ea0" /> | <img width="621" height="615" alt="image" src="https://github.com/user-attachments/assets/dadd851a-5a7a-468d-803d-3e467104ae06" /> | ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] UI standards followed - [x] Tests cover the new/changed behavior - [x] Performance impact considered, acceptable Release Notes: - Improved column filter dropdown in tabular data preview to sort values naturally (e.g., `2` before `10`). --------- Co-authored-by: MrSubidubi <finn@zed.dev>