From 89ebfbf73dbf68221de4e735ea75c4e7a4a7bf10 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 21 Dec 2020 18:58:48 +0100 Subject: [PATCH] Draw a separator between albums with the same name, but a different artist --- CHANGELOG.md | 1 + src/display.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55013952..4e9faf68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix crash on startup with Visualizer as the initial screen. * Fix crash on startup with Browser as the initial screen. * Show the Visualizer immediately if it's the initial screen. +* Draw a separator between albums with the same name, but a different artist. # ncmpcpp-0.9 (2020-12-20) * Fix various Mopidy specific bugs. diff --git a/src/display.cpp b/src/display.cpp index 59769c86..8a09c55d 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -88,8 +88,14 @@ void setProperties(NC::Menu &menu, const MPD::Song &s, const SongList &list, auto next = list.beginS() + drawn_pos + 1; if (next != list.endS()) { - if (next->song() != nullptr && next->song()->getAlbum() != s.getAlbum()) - separate_albums = true; + if (next->song() != nullptr) + { + // Draw a separator when the next album is different than the current + // one. In case there are two albums with the same name, but a different + // artist, compare also artists. + separate_albums = next->song()->getAlbum() != s.getAlbum() + || next->song()->getArtist() != s.getArtist(); + } } } if (separate_albums)