diff input/input.c @ 33306:37e215798390

Fix output of "No bind found for key" to actually make sense for key combinations and match the binding you'd have to add to input.conf also for these. Previously the extra keys would end up appended at the end, resulting in output like > No bind found for key 'MOUSE_BTN0'.-MOUSE_BTN2 and even worse for some translations.
author reimar
date Sat, 07 May 2011 11:11:07 +0000
parents d63bf64a2094
children 77bf38091051
line wrap: on
line diff
--- a/input/input.c	Sat May 07 10:59:11 2011 +0000
+++ b/input/input.c	Sat May 07 11:11:07 2011 +0000
@@ -1090,13 +1090,14 @@
     cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys);
 
   if(cmd == NULL) {
-    mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_NoBindFound,mp_input_get_key_name(keys[0]));
-    if(n > 1) {
-      int s;
-      for(s=1; s < n; s++)
-	mp_msg(MSGT_INPUT,MSGL_WARN,"-%s",mp_input_get_key_name(keys[s]));
+    char key_name[100];
+    int i;
+    av_strlcpy(key_name, mp_input_get_key_name(keys[0]), sizeof(key_name));
+    for (i = 1; i < n; i++) {
+      av_strlcat(key_name, "-", sizeof(key_name));
+      av_strlcat(key_name, mp_input_get_key_name(keys[i]), sizeof(key_name));
     }
-    mp_msg(MSGT_INPUT,MSGL_WARN,"                         \n");
+    mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_NoBindFound,key_name);
     return NULL;
   }
   if (strcmp(cmd, "ignore") == 0) return NULL;