Skip to content

Conversation

@raylu
Copy link
Contributor

@raylu raylu commented Jul 29, 2025

📺 PR Description

allow disabling of sorting, which makes ctrl+r way more useful

this partially addresses #194

Checklist

  • my commits and PR title follow the conventional commits format
  • if this is a new feature, I have added tests to consolidate the feature and prevent regressions
  • I have added a reasonable amount of documentation to the code where appropriate

@raylu raylu force-pushed the sort branch 2 times, most recently from 4436e97 to d648d40 Compare July 29, 2025 07:01
pub struct AppOptions {
/// Whether the application should use subsring matching instead of fuzzy
/// matching.
/// Whether the application should use subsring matching instead of fuzzy matching.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're changing this line anyways, can you please fix the typo subsring

@lalvarezt lalvarezt mentioned this pull request Jul 30, 2025
4 tasks
@alexpasmantier
Copy link
Owner

This looks great, nice job 👍🏻

Here are my thoughts:

I'm wondering if changing the semantics a bit could be less confusing to users. Although this really disables sorting in nucleo, I feel like we might want to hide that from the user and expose flags that reflect the user's intention rather than what's happening behind the scenes.

What I mean by the above is that disabling nucleo's internal sorting is almost always something the user will want to do when they actually care about sorting and so passing --sort=false in these scenarios feels kind of counter-intuitive.

I would change the sort=false flag and prepare for other sorting methods by using something like:

--sort='strategy'
enum SortingStrategy {
    #[default]
    Unsorted,  // the current behavior
    Natural,  // disabling nucleo's sorting -> entries keep their natural order 
              // (the order they were streamed in to tv)
    Frecency, 
    Template,  // this could for example extract a score from the entry using a template
}

This would also avoid having to do things like:

    #[serde(default = "default_true")]
    pub prefer_prefix: bool,
    #[serde(default = "default_true")]
    pub sort_results: bool,
}

fn default_true() -> bool {
    true
}

@alexpasmantier
Copy link
Owner

See #671 (comment) for more context.

@raylu raylu marked this pull request as ready for review August 2, 2025 05:04
@alexpasmantier alexpasmantier force-pushed the main branch 2 times, most recently from da3dfed to 7ff55dc Compare August 12, 2025 09:31
@gauravkumar37
Copy link

gauravkumar37 commented Oct 2, 2025

@alexpasmantier hey, given that config/channel refactor has landed 🎉 and this PR is supposed to precede #671 is this the right time to look at this one?
Thanks again for the excellent project, the only thing breaking for me at the moment is non-chronological sort order for shell history channel

@man-brain
Copy link

Any success here? Looks like it should fix the case for ctrl+r search results sorting.

@raylu
Copy link
Contributor Author

raylu commented Jan 2, 2026

I tried to implement SortingStrategy and got stuck
no objection if someone wants to take over

@alexpasmantier
Copy link
Owner

I'm planning to work on this in the coming days.

The reason for the delay is that I want to do this as a part of a bigger refactoring which might involve a bit more than a one evening session and have been a bit busy the last couple of weeks.

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.

5 participants