Changeset 13ebf92


Ignore:
Timestamp:
May 29, 2010, 1:13:50 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
44cc9ab
Parents:
89ce405
git-author:
David Benjamin <davidben@mit.edu> (05/24/10 14:51:11)
git-committer:
David Benjamin <davidben@mit.edu> (05/29/10 13:13:50)
Message:
Display submap bindings in :show keymap KEYMAP

We don't recursively expand when running :show keymaps since we're
already displaying every keymap.

Signed-off-by: David Benjamin <davidben@mit.edu>
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r89ab5c8 r13ebf92  
    28792879    km = owl_keyhandler_get_keymap(kh, kmname);
    28802880    owl_fmtext_append_bold(&fm, "\n\n----------------------------------------------------------------------------------------------------\n\n");
    2881     owl_keymap_get_details(km, &fm);   
     2881    owl_keymap_get_details(km, &fm, 0);
    28822882  }
    28832883  owl_fmtext_append_normal(&fm, "\n");
     
    29052905  km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
    29062906  if (km) {
    2907     owl_keymap_get_details(km, &fm);
     2907    owl_keymap_get_details(km, &fm, 1);
    29082908  } else {
    29092909    owl_fmtext_append_normal(&fm, "No such keymap...\n");
  • keymap.c

    r8a921b5 r13ebf92  
    11#include <string.h>
    22#include "owl.h"
     3
     4static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm);
     5static void _owl_keymap_format_with_submaps(const owl_keymap *km, owl_fmtext *fm);
    36
    47/* returns 0 on success */
     
    8689
    8790/* Appends details about the keymap to fm */
    88 void owl_keymap_get_details(const owl_keymap *km, owl_fmtext *fm)
    89 {
    90   int i, nbindings;
    91   const owl_keybinding *kb;
    92  
     91void owl_keymap_get_details(const owl_keymap *km, owl_fmtext *fm, int recurse)
     92{
    9393  owl_fmtext_append_bold(fm, "KEYMAP - ");
    9494  owl_fmtext_append_bold(fm, km->name);
     
    119119
    120120  owl_fmtext_append_bold(fm, "\nKey bindings:\n\n"); 
     121  if (recurse) {
     122    _owl_keymap_format_with_submaps(km, fm);
     123  } else {
     124    _owl_keymap_format_bindings(km, fm);
     125  }
     126}
     127
     128static void _owl_keymap_format_with_submaps(const owl_keymap *km, owl_fmtext *fm)
     129{
     130  while (km) {
     131    _owl_keymap_format_bindings(km, fm);
     132    km = km->submap;
     133    if (km) {
     134      owl_fmtext_append_bold(fm, "\nInherited from ");
     135      owl_fmtext_append_bold(fm, km->name);
     136      owl_fmtext_append_bold(fm, ":\n\n");
     137    }
     138  }
     139}
     140
     141static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm)
     142{
     143  int i, nbindings;
     144  const owl_keybinding *kb;
     145 
    121146  nbindings = owl_list_get_size(&km->bindings);
    122147  for (i=0; i<nbindings; i++) {
Note: See TracChangeset for help on using the changeset viewer.