mistake with keymods
[vg.git] / vg_console.h
index 8d35aa286fdce8933e35b39720cd5dfd6534d850..e18515d45cd029e3d422da5c09881994193a7fc0 100644 (file)
@@ -655,7 +655,7 @@ VG_STATIC void console_proc_key( SDL_Keysym ev )
    }
    
    if( !vg_console.enabled ) return;
-   
+
    struct console_mapping
    {
       u16 mod;
@@ -663,7 +663,7 @@ VG_STATIC void console_proc_key( SDL_Keysym ev )
       
       void (*handler)(void);
    }
-   mapping[] =
+   mappings[] =
    {
       { 0,              SDLK_LEFT,       _console_left              },
       { KMOD_SHIFT,     SDLK_LEFT,       _console_left_select       },
@@ -684,23 +684,25 @@ VG_STATIC void console_proc_key( SDL_Keysym ev )
       { 0,              SDLK_RETURN,     _console_enter             }
    };
 
-   for( int i=0; i<vg_list_size( mapping ); i++ )
+   SDL_Keymod mod = ev.mod & (KMOD_SHIFT|KMOD_CTRL|KMOD_ALT);
+
+   for( int i=0; i<vg_list_size( mappings ); i++ )
    {
-      struct console_mapping *mk = &mapping[i];
+      struct console_mapping *mapping = &mappings[i];
 
-      if( mk->key == ev.sym )
+      if( mapping->key == ev.sym )
       {
-         if( mk->mod == 0 )
+         if( mapping->mod == 0 )
          {
-            if( ev.mod == 0 )
+            if( mod == 0 )
             {
-               mk->handler();
+               mapping->handler();
                return;
             }
          }
-         else if( (ev.mod & mk->mod) == mk->mod )
+         else if( (mod & mapping->mod) == mapping->mod )
          {
-            mk->handler();
+            mapping->handler();
             return;
          }
       }