Repository: cantino/mcfly (language: rust)

Issue:
Sorting by time is not sorting by time
Setting sorting to `LAST_RUN`, or use F1 to switch sorting option to "Sort to Time", and the result is not sorted by time.

![a](https://user-images.githubusercontent.com/366851/189336528-12e2fc43-cf91-475a-a00b-b7552d35d7bc.png)



Discussion / hints:
I think this is because `MCFLY_FUZZY` is not 0, which I think is a surprising behavior. Sort by time should sort strictly by time.

This happens even when search term is empty, I think fuzziness shouldn't have an effect when no search term is set?

Fix patch:
diff --git a/src/history/history.rs b/src/history/history.rs
index 3f7d3362..39f44d89 100644
--- a/src/history/history.rs
+++ b/src/history/history.rs
@@ -396,7 +396,7 @@ impl History {
             }));
         }
 
-        if fuzzy > 0 {
+        if fuzzy > 0 && result_sort != &ResultSort::LastRun {
             names = names
                 .into_iter()
                 .sorted_by(|a, b| {
diff --git a/src/settings.rs b/src/settings.rs
index bd95ed36..528e6a9f 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -37,7 +37,7 @@ pub enum InterfaceView {
     Bottom,
 }
 
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub enum ResultSort {
     Rank,
     LastRun,


Test patch: