root/lib/keybind.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. name_keymap_comparator
  2. sort_command_names
  3. keymap_add
  4. keybind_cmd_bind
  5. keybind_lookup_action
  6. keybind_lookup_actionname
  7. keybind_lookup_keymap_shortcut
  8. keybind_lookup_keymap_command

   1 /*
   2    Definitions of key bindings.
   3 
   4    Copyright (C) 2005-2021
   5    Free Software Foundation, Inc.
   6 
   7    Written by:
   8    Vitja Makarov, 2005
   9    Ilia Maslakov <il.smind@gmail.com>, 2009, 2012
  10    Andrew Borodin <aborodin@vmail.ru>, 2009-2020
  11 
  12    This file is part of the Midnight Commander.
  13 
  14    The Midnight Commander is free software: you can redistribute it
  15    and/or modify it under the terms of the GNU General Public License as
  16    published by the Free Software Foundation, either version 3 of the License,
  17    or (at your option) any later version.
  18 
  19    The Midnight Commander is distributed in the hope that it will be useful,
  20    but WITHOUT ANY WARRANTY; without even the implied warranty of
  21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22    GNU General Public License for more details.
  23 
  24    You should have received a copy of the GNU General Public License
  25    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  26  */
  27 
  28 #include <config.h>
  29 
  30 #include <ctype.h>
  31 #include <stdlib.h>
  32 #include <string.h>
  33 #include <sys/types.h>
  34 
  35 #include "lib/global.h"
  36 #include "lib/tty/key.h"        /* KEY_M_ */
  37 #include "lib/keybind.h"
  38 
  39 /*** global variables ****************************************************************************/
  40 
  41 /*** file scope macro definitions ****************************************************************/
  42 
  43 #define ADD_KEYMAP_NAME(name) \
  44     { #name, CK_##name }
  45 
  46 /*** file scope type declarations ****************************************************************/
  47 
  48 typedef struct name_keymap_t
  49 {
  50     const char *name;
  51     long val;
  52 } name_keymap_t;
  53 
  54 /*** file scope variables ************************************************************************/
  55 
  56 static name_keymap_t command_names[] = {
  57     /* common */
  58     ADD_KEYMAP_NAME (InsertChar),
  59     ADD_KEYMAP_NAME (Enter),
  60     ADD_KEYMAP_NAME (ChangePanel),
  61     ADD_KEYMAP_NAME (Up),
  62     ADD_KEYMAP_NAME (Down),
  63     ADD_KEYMAP_NAME (Left),
  64     ADD_KEYMAP_NAME (Right),
  65     ADD_KEYMAP_NAME (LeftQuick),
  66     ADD_KEYMAP_NAME (RightQuick),
  67     ADD_KEYMAP_NAME (Home),
  68     ADD_KEYMAP_NAME (End),
  69     ADD_KEYMAP_NAME (PageUp),
  70     ADD_KEYMAP_NAME (PageDown),
  71     ADD_KEYMAP_NAME (HalfPageUp),
  72     ADD_KEYMAP_NAME (HalfPageDown),
  73     ADD_KEYMAP_NAME (Top),
  74     ADD_KEYMAP_NAME (Bottom),
  75     ADD_KEYMAP_NAME (TopOnScreen),
  76     ADD_KEYMAP_NAME (MiddleOnScreen),
  77     ADD_KEYMAP_NAME (BottomOnScreen),
  78     ADD_KEYMAP_NAME (WordLeft),
  79     ADD_KEYMAP_NAME (WordRight),
  80     ADD_KEYMAP_NAME (Copy),
  81     ADD_KEYMAP_NAME (Move),
  82     ADD_KEYMAP_NAME (Delete),
  83     ADD_KEYMAP_NAME (MakeDir),
  84     ADD_KEYMAP_NAME (ChangeMode),
  85     ADD_KEYMAP_NAME (ChangeOwn),
  86     ADD_KEYMAP_NAME (ChangeOwnAdvanced),
  87 #ifdef ENABLE_EXT2FS_ATTR
  88     ADD_KEYMAP_NAME (ChangeAttributes),
  89 #endif
  90     ADD_KEYMAP_NAME (Remove),
  91     ADD_KEYMAP_NAME (BackSpace),
  92     ADD_KEYMAP_NAME (Redo),
  93     ADD_KEYMAP_NAME (Clear),
  94     ADD_KEYMAP_NAME (Menu),
  95     ADD_KEYMAP_NAME (MenuLastSelected),
  96     ADD_KEYMAP_NAME (UserMenu),
  97     ADD_KEYMAP_NAME (EditUserMenu),
  98     ADD_KEYMAP_NAME (Search),
  99     ADD_KEYMAP_NAME (SearchContinue),
 100     ADD_KEYMAP_NAME (Replace),
 101     ADD_KEYMAP_NAME (ReplaceContinue),
 102     ADD_KEYMAP_NAME (Help),
 103     ADD_KEYMAP_NAME (Shell),
 104     ADD_KEYMAP_NAME (Edit),
 105     ADD_KEYMAP_NAME (EditNew),
 106 #ifdef HAVE_CHARSET
 107     ADD_KEYMAP_NAME (SelectCodepage),
 108 #endif
 109     ADD_KEYMAP_NAME (EditorViewerHistory),
 110     ADD_KEYMAP_NAME (History),
 111     ADD_KEYMAP_NAME (HistoryNext),
 112     ADD_KEYMAP_NAME (HistoryPrev),
 113     ADD_KEYMAP_NAME (Complete),
 114     ADD_KEYMAP_NAME (Save),
 115     ADD_KEYMAP_NAME (SaveAs),
 116     ADD_KEYMAP_NAME (Goto),
 117     ADD_KEYMAP_NAME (Reread),
 118     ADD_KEYMAP_NAME (Refresh),
 119     ADD_KEYMAP_NAME (Suspend),
 120     ADD_KEYMAP_NAME (Swap),
 121     ADD_KEYMAP_NAME (HotList),
 122     ADD_KEYMAP_NAME (SelectInvert),
 123     ADD_KEYMAP_NAME (ScreenList),
 124     ADD_KEYMAP_NAME (ScreenNext),
 125     ADD_KEYMAP_NAME (ScreenPrev),
 126     ADD_KEYMAP_NAME (FileNext),
 127     ADD_KEYMAP_NAME (FilePrev),
 128     ADD_KEYMAP_NAME (DeleteToHome),
 129     ADD_KEYMAP_NAME (DeleteToEnd),
 130     ADD_KEYMAP_NAME (DeleteToWordBegin),
 131     ADD_KEYMAP_NAME (DeleteToWordEnd),
 132     ADD_KEYMAP_NAME (Cut),
 133     ADD_KEYMAP_NAME (Store),
 134     ADD_KEYMAP_NAME (Paste),
 135     ADD_KEYMAP_NAME (Mark),
 136     ADD_KEYMAP_NAME (MarkLeft),
 137     ADD_KEYMAP_NAME (MarkRight),
 138     ADD_KEYMAP_NAME (MarkUp),
 139     ADD_KEYMAP_NAME (MarkDown),
 140     ADD_KEYMAP_NAME (MarkToWordBegin),
 141     ADD_KEYMAP_NAME (MarkToWordEnd),
 142     ADD_KEYMAP_NAME (MarkToHome),
 143     ADD_KEYMAP_NAME (MarkToEnd),
 144     ADD_KEYMAP_NAME (ToggleNavigation),
 145     ADD_KEYMAP_NAME (Sort),
 146     ADD_KEYMAP_NAME (Options),
 147     ADD_KEYMAP_NAME (LearnKeys),
 148     ADD_KEYMAP_NAME (Bookmark),
 149     ADD_KEYMAP_NAME (Quit),
 150     ADD_KEYMAP_NAME (QuitQuiet),
 151     ADD_KEYMAP_NAME (ExtendedKeyMap),
 152 
 153     /* main commands */
 154 #ifdef USE_INTERNAL_EDIT
 155     ADD_KEYMAP_NAME (EditForceInternal),
 156 #endif
 157     ADD_KEYMAP_NAME (View),
 158     ADD_KEYMAP_NAME (ViewRaw),
 159     ADD_KEYMAP_NAME (ViewFile),
 160     ADD_KEYMAP_NAME (ViewFiltered),
 161     ADD_KEYMAP_NAME (Find),
 162     ADD_KEYMAP_NAME (DirSize),
 163     ADD_KEYMAP_NAME (CompareDirs),
 164 #ifdef USE_DIFF_VIEW
 165     ADD_KEYMAP_NAME (CompareFiles),
 166 #endif
 167     ADD_KEYMAP_NAME (OptionsVfs),
 168     ADD_KEYMAP_NAME (OptionsConfirm),
 169     ADD_KEYMAP_NAME (OptionsDisplayBits),
 170     ADD_KEYMAP_NAME (EditExtensionsFile),
 171     ADD_KEYMAP_NAME (EditFileHighlightFile),
 172     ADD_KEYMAP_NAME (LinkSymbolicEdit),
 173     ADD_KEYMAP_NAME (ExternalPanelize),
 174     ADD_KEYMAP_NAME (Filter),
 175 #ifdef ENABLE_VFS_FISH
 176     ADD_KEYMAP_NAME (ConnectFish),
 177 #endif
 178 #ifdef ENABLE_VFS_FTP
 179     ADD_KEYMAP_NAME (ConnectFtp),
 180 #endif
 181 #ifdef ENABLE_VFS_SFTP
 182     ADD_KEYMAP_NAME (ConnectSftp),
 183 #endif
 184 #ifdef ENABLE_VFS_SMB
 185     ADD_KEYMAP_NAME (ConnectSmb),
 186 #endif
 187     ADD_KEYMAP_NAME (PanelInfo),
 188 #ifdef ENABLE_BACKGROUND
 189     ADD_KEYMAP_NAME (Jobs),
 190 #endif
 191     ADD_KEYMAP_NAME (OptionsLayout),
 192     ADD_KEYMAP_NAME (OptionsAppearance),
 193     ADD_KEYMAP_NAME (Link),
 194     ADD_KEYMAP_NAME (SetupListingFormat),
 195     ADD_KEYMAP_NAME (PanelListing),
 196 #ifdef LISTMODE_EDITOR
 197     ADD_KEYMAP_NAME (ListMode),
 198 #endif
 199     ADD_KEYMAP_NAME (OptionsPanel),
 200     ADD_KEYMAP_NAME (CdQuick),
 201     ADD_KEYMAP_NAME (PanelQuickView),
 202     ADD_KEYMAP_NAME (LinkSymbolicRelative),
 203     ADD_KEYMAP_NAME (VfsList),
 204     ADD_KEYMAP_NAME (SaveSetup),
 205     ADD_KEYMAP_NAME (LinkSymbolic),
 206     ADD_KEYMAP_NAME (PanelTree),
 207     ADD_KEYMAP_NAME (Tree),
 208 #ifdef ENABLE_VFS_UNDELFS
 209     ADD_KEYMAP_NAME (Undelete),
 210 #endif
 211     ADD_KEYMAP_NAME (PutCurrentLink),
 212     ADD_KEYMAP_NAME (PutOtherLink),
 213     ADD_KEYMAP_NAME (HotListAdd),
 214     ADD_KEYMAP_NAME (ShowHidden),
 215     ADD_KEYMAP_NAME (SplitVertHoriz),
 216     ADD_KEYMAP_NAME (SplitEqual),
 217     ADD_KEYMAP_NAME (SplitMore),
 218     ADD_KEYMAP_NAME (SplitLess),
 219     ADD_KEYMAP_NAME (PutCurrentPath),
 220     ADD_KEYMAP_NAME (PutOtherPath),
 221     ADD_KEYMAP_NAME (PutCurrentSelected),
 222     ADD_KEYMAP_NAME (PutCurrentFullSelected),
 223     ADD_KEYMAP_NAME (PutCurrentTagged),
 224     ADD_KEYMAP_NAME (PutOtherTagged),
 225     ADD_KEYMAP_NAME (Select),
 226     ADD_KEYMAP_NAME (Unselect),
 227 
 228     /* panel */
 229     ADD_KEYMAP_NAME (SelectExt),
 230     ADD_KEYMAP_NAME (ScrollLeft),
 231     ADD_KEYMAP_NAME (ScrollRight),
 232     ADD_KEYMAP_NAME (PanelOtherCd),
 233     ADD_KEYMAP_NAME (PanelOtherCdLink),
 234     ADD_KEYMAP_NAME (CopySingle),
 235     ADD_KEYMAP_NAME (MoveSingle),
 236     ADD_KEYMAP_NAME (DeleteSingle),
 237     ADD_KEYMAP_NAME (CdParent),
 238     ADD_KEYMAP_NAME (CdChild),
 239     ADD_KEYMAP_NAME (Panelize),
 240     ADD_KEYMAP_NAME (PanelOtherSync),
 241     ADD_KEYMAP_NAME (SortNext),
 242     ADD_KEYMAP_NAME (SortPrev),
 243     ADD_KEYMAP_NAME (SortReverse),
 244     ADD_KEYMAP_NAME (SortByName),
 245     ADD_KEYMAP_NAME (SortByExt),
 246     ADD_KEYMAP_NAME (SortBySize),
 247     ADD_KEYMAP_NAME (SortByMTime),
 248     ADD_KEYMAP_NAME (CdParentSmart),
 249     ADD_KEYMAP_NAME (CycleListingFormat),
 250 
 251     /* dialog */
 252     ADD_KEYMAP_NAME (Ok),
 253     ADD_KEYMAP_NAME (Cancel),
 254 
 255     /* input line */
 256     ADD_KEYMAP_NAME (Yank),
 257 
 258     /* help */
 259     ADD_KEYMAP_NAME (Index),
 260     ADD_KEYMAP_NAME (Back),
 261     ADD_KEYMAP_NAME (LinkNext),
 262     ADD_KEYMAP_NAME (LinkPrev),
 263     ADD_KEYMAP_NAME (NodeNext),
 264     ADD_KEYMAP_NAME (NodePrev),
 265 
 266     /* tree */
 267     ADD_KEYMAP_NAME (Forget),
 268 
 269 #if defined (USE_INTERNAL_EDIT) || defined (USE_DIFF_VIEW)
 270     ADD_KEYMAP_NAME (ShowNumbers),
 271 #endif
 272 
 273     /* chattr dialog */
 274     ADD_KEYMAP_NAME (MarkAndDown),
 275 
 276 #ifdef USE_INTERNAL_EDIT
 277     ADD_KEYMAP_NAME (Close),
 278     ADD_KEYMAP_NAME (Tab),
 279     ADD_KEYMAP_NAME (Undo),
 280     ADD_KEYMAP_NAME (ScrollUp),
 281     ADD_KEYMAP_NAME (ScrollDown),
 282     ADD_KEYMAP_NAME (Return),
 283     ADD_KEYMAP_NAME (ParagraphUp),
 284     ADD_KEYMAP_NAME (ParagraphDown),
 285     ADD_KEYMAP_NAME (EditFile),
 286     ADD_KEYMAP_NAME (MarkWord),
 287     ADD_KEYMAP_NAME (MarkLine),
 288     ADD_KEYMAP_NAME (MarkAll),
 289     ADD_KEYMAP_NAME (Unmark),
 290     ADD_KEYMAP_NAME (MarkColumn),
 291     ADD_KEYMAP_NAME (BlockSave),
 292     ADD_KEYMAP_NAME (InsertFile),
 293     ADD_KEYMAP_NAME (InsertOverwrite),
 294     ADD_KEYMAP_NAME (Date),
 295     ADD_KEYMAP_NAME (DeleteLine),
 296     ADD_KEYMAP_NAME (EditMail),
 297     ADD_KEYMAP_NAME (ParagraphFormat),
 298     ADD_KEYMAP_NAME (MatchBracket),
 299     ADD_KEYMAP_NAME (ExternalCommand),
 300     ADD_KEYMAP_NAME (MacroStartRecord),
 301     ADD_KEYMAP_NAME (MacroStopRecord),
 302     ADD_KEYMAP_NAME (MacroStartStopRecord),
 303     ADD_KEYMAP_NAME (MacroDelete),
 304     ADD_KEYMAP_NAME (RepeatStartStopRecord),
 305 #ifdef HAVE_ASPELL
 306     ADD_KEYMAP_NAME (SpellCheck),
 307     ADD_KEYMAP_NAME (SpellCheckCurrentWord),
 308     ADD_KEYMAP_NAME (SpellCheckSelectLang),
 309 #endif /* HAVE_ASPELL */
 310     ADD_KEYMAP_NAME (BookmarkFlush),
 311     ADD_KEYMAP_NAME (BookmarkNext),
 312     ADD_KEYMAP_NAME (BookmarkPrev),
 313     ADD_KEYMAP_NAME (MarkPageUp),
 314     ADD_KEYMAP_NAME (MarkPageDown),
 315     ADD_KEYMAP_NAME (MarkToFileBegin),
 316     ADD_KEYMAP_NAME (MarkToFileEnd),
 317     ADD_KEYMAP_NAME (MarkToPageBegin),
 318     ADD_KEYMAP_NAME (MarkToPageEnd),
 319     ADD_KEYMAP_NAME (MarkScrollUp),
 320     ADD_KEYMAP_NAME (MarkScrollDown),
 321     ADD_KEYMAP_NAME (MarkParagraphUp),
 322     ADD_KEYMAP_NAME (MarkParagraphDown),
 323     ADD_KEYMAP_NAME (MarkColumnPageUp),
 324     ADD_KEYMAP_NAME (MarkColumnPageDown),
 325     ADD_KEYMAP_NAME (MarkColumnLeft),
 326     ADD_KEYMAP_NAME (MarkColumnRight),
 327     ADD_KEYMAP_NAME (MarkColumnUp),
 328     ADD_KEYMAP_NAME (MarkColumnDown),
 329     ADD_KEYMAP_NAME (MarkColumnScrollUp),
 330     ADD_KEYMAP_NAME (MarkColumnScrollDown),
 331     ADD_KEYMAP_NAME (MarkColumnParagraphUp),
 332     ADD_KEYMAP_NAME (MarkColumnParagraphDown),
 333     ADD_KEYMAP_NAME (BlockShiftLeft),
 334     ADD_KEYMAP_NAME (BlockShiftRight),
 335     ADD_KEYMAP_NAME (InsertLiteral),
 336     ADD_KEYMAP_NAME (ShowTabTws),
 337     ADD_KEYMAP_NAME (SyntaxOnOff),
 338     ADD_KEYMAP_NAME (SyntaxChoose),
 339     ADD_KEYMAP_NAME (ShowMargin),
 340     ADD_KEYMAP_NAME (OptionsSaveMode),
 341     ADD_KEYMAP_NAME (About),
 342     /* An action to run external script from macro */
 343     {"ExecuteScript", CK_PipeBlock (0)},
 344     ADD_KEYMAP_NAME (WindowMove),
 345     ADD_KEYMAP_NAME (WindowResize),
 346     ADD_KEYMAP_NAME (WindowFullscreen),
 347     ADD_KEYMAP_NAME (WindowList),
 348     ADD_KEYMAP_NAME (WindowNext),
 349     ADD_KEYMAP_NAME (WindowPrev),
 350 #endif /* USE_INTERNAL_EDIT */
 351 
 352     /* viewer */
 353     ADD_KEYMAP_NAME (WrapMode),
 354     ADD_KEYMAP_NAME (HexEditMode),
 355     ADD_KEYMAP_NAME (HexMode),
 356     ADD_KEYMAP_NAME (MagicMode),
 357     ADD_KEYMAP_NAME (NroffMode),
 358     ADD_KEYMAP_NAME (BookmarkGoto),
 359     ADD_KEYMAP_NAME (Ruler),
 360     ADD_KEYMAP_NAME (SearchForward),
 361     ADD_KEYMAP_NAME (SearchBackward),
 362     ADD_KEYMAP_NAME (SearchForwardContinue),
 363     ADD_KEYMAP_NAME (SearchBackwardContinue),
 364     ADD_KEYMAP_NAME (SearchOppositeContinue),
 365 
 366 #ifdef USE_DIFF_VIEW
 367     /* diff viewer */
 368     ADD_KEYMAP_NAME (ShowSymbols),
 369     ADD_KEYMAP_NAME (SplitFull),
 370     ADD_KEYMAP_NAME (Tab2),
 371     ADD_KEYMAP_NAME (Tab3),
 372     ADD_KEYMAP_NAME (Tab4),
 373     ADD_KEYMAP_NAME (Tab8),
 374     ADD_KEYMAP_NAME (HunkNext),
 375     ADD_KEYMAP_NAME (HunkPrev),
 376     ADD_KEYMAP_NAME (EditOther),
 377     ADD_KEYMAP_NAME (Merge),
 378     ADD_KEYMAP_NAME (MergeOther),
 379 #endif /* USE_DIFF_VIEW */
 380 
 381     {NULL, CK_IgnoreKey}
 382 };
 383 
 384 /* *INDENT-OFF* */
 385 static const size_t num_command_names = G_N_ELEMENTS (command_names) - 1;
 386 /* *INDENT-ON* */
 387 
 388 /*** file scope functions ************************************************************************/
 389 /* --------------------------------------------------------------------------------------------- */
 390 
 391 static int
 392 name_keymap_comparator (const void *p1, const void *p2)
     /* [previous][next][first][last][top][bottom][index][help]  */
 393 {
 394     const name_keymap_t *m1 = (const name_keymap_t *) p1;
 395     const name_keymap_t *m2 = (const name_keymap_t *) p2;
 396 
 397     return g_ascii_strcasecmp (m1->name, m2->name);
 398 }
 399 
 400 /* --------------------------------------------------------------------------------------------- */
 401 
 402 static inline void
 403 sort_command_names (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 404 {
 405     static gboolean has_been_sorted = FALSE;
 406 
 407     if (!has_been_sorted)
 408     {
 409         qsort (command_names, num_command_names,
 410                sizeof (command_names[0]), &name_keymap_comparator);
 411         has_been_sorted = TRUE;
 412     }
 413 }
 414 
 415 /* --------------------------------------------------------------------------------------------- */
 416 
 417 static void
 418 keymap_add (GArray * keymap, long key, long cmd, const char *caption)
     /* [previous][next][first][last][top][bottom][index][help]  */
 419 {
 420     if (key != 0 && cmd != CK_IgnoreKey)
 421     {
 422         global_keymap_t new_bind;
 423 
 424         new_bind.key = key;
 425         new_bind.command = cmd;
 426         g_snprintf (new_bind.caption, sizeof (new_bind.caption), "%s", caption);
 427         g_array_append_val (keymap, new_bind);
 428     }
 429 }
 430 
 431 /* --------------------------------------------------------------------------------------------- */
 432 /*** public functions ****************************************************************************/
 433 /* --------------------------------------------------------------------------------------------- */
 434 
 435 void
 436 keybind_cmd_bind (GArray * keymap, const char *keybind, long action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 437 {
 438     char *caption = NULL;
 439     long key;
 440 
 441     key = lookup_key (keybind, &caption);
 442     keymap_add (keymap, key, action, caption);
 443     g_free (caption);
 444 }
 445 
 446 /* --------------------------------------------------------------------------------------------- */
 447 
 448 long
 449 keybind_lookup_action (const char *name)
     /* [previous][next][first][last][top][bottom][index][help]  */
 450 {
 451     const name_keymap_t key = { name, 0 };
 452     name_keymap_t *res;
 453 
 454     sort_command_names ();
 455 
 456     res = bsearch (&key, command_names, num_command_names,
 457                    sizeof (command_names[0]), name_keymap_comparator);
 458 
 459     return (res != NULL) ? res->val : CK_IgnoreKey;
 460 }
 461 
 462 /* --------------------------------------------------------------------------------------------- */
 463 
 464 const char *
 465 keybind_lookup_actionname (long action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 466 {
 467     size_t i;
 468 
 469     for (i = 0; command_names[i].name != NULL; i++)
 470         if (command_names[i].val == action)
 471             return command_names[i].name;
 472 
 473     return NULL;
 474 }
 475 
 476 /* --------------------------------------------------------------------------------------------- */
 477 
 478 const char *
 479 keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 480 {
 481     if (keymap != NULL)
 482     {
 483         size_t i;
 484 
 485         for (i = 0; keymap[i].key != 0; i++)
 486             if (keymap[i].command == action)
 487                 return (keymap[i].caption[0] != '\0') ? keymap[i].caption : NULL;
 488     }
 489     return NULL;
 490 }
 491 
 492 /* --------------------------------------------------------------------------------------------- */
 493 
 494 long
 495 keybind_lookup_keymap_command (const global_keymap_t * keymap, long key)
     /* [previous][next][first][last][top][bottom][index][help]  */
 496 {
 497     if (keymap != NULL)
 498     {
 499         size_t i;
 500 
 501         for (i = 0; keymap[i].key != 0; i++)
 502             if (keymap[i].key == key)
 503                 return keymap[i].command;
 504     }
 505 
 506     return CK_IgnoreKey;
 507 }
 508 
 509 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */