From 4a6e7d305b0b5a8ab101ff05f541f527f2d2bc42 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 1 Sep 2017 11:02:43 +0200 Subject: [PATCH] Default to sorting songs in media library by their display format instead of name --- NEWS | 2 +- src/screens/media_library.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 02e5efa2..1652e7f5 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ ncmpcpp-0.8.1 (????-??-??) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. -* If songs in media library have no track numbers, sort them by name. +* If songs in media library have no track numbers, sort them by their display format. * Fixed a situation in which songs added to playlist from media library or playlist editor screens would not be immediately marked as such. ncmpcpp-0.8 (2017-05-21) diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index 33fba24e..06f4081c 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -127,8 +127,9 @@ public: if (ret != 0) return ret < 0; - // If there are no track numbers, sort by name. - return a.getName() < b.getName(); + // If track numbers are equal, sort by the display format. + return Format::stringify(Config.song_library_format, &a) + < Format::stringify(Config.song_library_format, &b); } };