conf: translate deprecated names in "screen-list"
authorMax Kellermann <max@musicpd.org>
Mon, 19 Aug 2019 12:18:59 +0000 (14:18 +0200)
committerMax Kellermann <max@musicpd.org>
Mon, 19 Aug 2019 12:18:59 +0000 (14:18 +0200)
NEWS
src/conf.cxx

diff --git a/NEWS b/NEWS
index 7b0b081..37d6eca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ ncmpc 0.35 - not yet released
 * fall back to "AlbumArtist" tag in the default format
 * fix crash with a very narrow terminal window
 * config: allow escaping single quote with backslash in key bindings
+* config: fix bug with deprecated names in "screen-list" setting
 
 ncmpc 0.34 - (2019-04-10)
 * show total duration of range selection in status bar
index c0187ee..08af8fa 100644 (file)
@@ -28,6 +28,7 @@
 #include "BasicColors.hxx"
 #include "CustomColors.hxx"
 #include "screen_list.hxx"
+#include "PageMeta.hxx"
 #include "Options.hxx"
 #include "io/Path.hxx"
 #include "util/CharUtil.hxx"
@@ -370,12 +371,16 @@ check_screen_list(char *value)
        while (char *name = NextItem(value)) {
                std::transform(name, name + strlen(name), name, tolower);
 
-               if (screen_lookup_name(name) == nullptr) {
+               const auto *page_meta = screen_lookup_name(name);
+               if (page_meta == nullptr) {
                        /* an unknown screen name was specified in the
                           configuration file */
                        print_error(_("Unknown screen name"), name);
                } else {
-                       screen.emplace_back(name);
+                       /* use PageMeta::name because
+                          screen_lookup_name() may have translated a
+                          deprecated name */
+                       screen.emplace_back(page_meta->name);
                }
        }