From db109be8a28f1556495979ee7d1967e982cca6fd Mon Sep 17 00:00:00 2001
From: Andrew Borodin <aborodin@vmail.ru>
Date: Mon, 23 May 2022 20:52:30 +0300
Subject: [PATCH] Ticket #4374: fix file sort by version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
---
 src/filemanager/dir.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
index 5862da6f9c..65a80cf12f 100644
--- a/src/filemanager/dir.c
+++ b/src/filemanager/dir.c
@@ -358,7 +358,15 @@ sort_vers (file_entry_t * a, file_entry_t * b)
     int bd = MY_ISDIR (b);
 
     if (ad == bd || panels_options.mix_all_files)
-        return filevercmp (a->fname->str, b->fname->str) * reverse;
+    {
+        int result;
+
+        result = filevercmp (a->fname->str, b->fname->str);
+        if (result != 0)
+            return result * reverse;
+
+        return sort_name (a, b);
+    }
 
     return bd - ad;
 }
