Code

release v0.29
[ncmpc.git] / src / screen_utils.c
index 891b9b3cb61bac1f673d1d45908712839d84f09d..6c5ce43368c5310058534d9df608b613a1736ac6 100644 (file)
@@ -41,7 +41,12 @@ screen_bell(void)
 static bool
 ignore_key(int key)
 {
-       return key == ERR;
+       return
+#ifdef HAVE_GETMOUSE
+               /* ignore mouse events */
+               key == KEY_MOUSE ||
+#endif
+               key == ERR;
 }
 
 int
@@ -60,12 +65,6 @@ screen_getch(const char *prompt)
        int key;
        while (ignore_key(key = wgetch(w))) {}
 
-#ifdef HAVE_GETMOUSE
-       /* ignore mouse events */
-       if (key == KEY_MOUSE)
-               return screen_getch(prompt);
-#endif
-
        noecho();
        curs_set(0);
 
@@ -73,12 +72,15 @@ screen_getch(const char *prompt)
 }
 
 bool
-screen_get_yesno(const char *prompt, bool def)
+screen_get_yesno(const char *_prompt, bool def)
 {
        /* NOTE: if one day a translator decides to use a multi-byte character
           for one of the yes/no keys, we'll have to parse it properly */
 
+       char *prompt = g_strdup_printf(_("%s [%s/%s] "), _prompt, YES, NO);
        int key = tolower(screen_getch(prompt));
+       g_free(prompt);
+
        if (key == YES[0])
                return true;
        else if (key == NO[0])