Changeset 44cc9ab


Ignore:
Timestamp:
May 29, 2010, 1:13:50 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
449af72, d27ecf3
Parents:
13ebf92
git-author:
David Benjamin <davidben@mit.edu> (05/24/10 15:08:44)
git-committer:
David Benjamin <davidben@mit.edu> (05/29/10 13:13:50)
Message:
While we're at it, rename submap to parent

Should be more consistent with other programs.

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

Legend:

Unmodified
Added
Removed
  • doc/code.txt

    r1286893 r44cc9ab  
    8686             Meta.  At any one time, there is exactly one active
    8787             keymap which determines where keybindings are looked for
    88              (along with its submaps).
     88             (along with its parents).
    8989
    9090list:        Simple list abstraction.  (Uses realloc to resize the list.)
  • keymap.c

    r13ebf92 r44cc9ab  
    33
    44static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm);
    5 static void _owl_keymap_format_with_submaps(const owl_keymap *km, owl_fmtext *fm);
     5static void _owl_keymap_format_with_parents(const owl_keymap *km, owl_fmtext *fm);
    66
    77/* returns 0 on success */
     
    1212  if ((km->desc = owl_strdup(desc)) == NULL) return(-1);
    1313  if (0 != owl_list_create(&km->bindings)) return(-1);
    14   km->submap = NULL;
     14  km->parent = NULL;
    1515  km->default_fn = default_fn;
    1616  km->prealways_fn = prealways_fn;
     
    2727}
    2828
    29 void owl_keymap_set_submap(owl_keymap *km, const owl_keymap *submap)
    30 {
    31   km->submap = submap;
     29void owl_keymap_set_parent(owl_keymap *km, const owl_keymap *parent)
     30{
     31  km->parent = parent;
    3232}
    3333
     
    9999    owl_fmtext_append_normal(fm, "\n");
    100100  }
    101   if (km->submap) {
    102     owl_fmtext_append_normal(fm, OWL_TABSTR "Has submap: ");
    103     owl_fmtext_append_normal(fm, km->submap->name);
     101  if (km->parent) {
     102    owl_fmtext_append_normal(fm, OWL_TABSTR "Has parent: ");
     103    owl_fmtext_append_normal(fm, km->parent->name);
    104104    owl_fmtext_append_normal(fm, "\n");
    105105  }
     
    120120  owl_fmtext_append_bold(fm, "\nKey bindings:\n\n"); 
    121121  if (recurse) {
    122     _owl_keymap_format_with_submaps(km, fm);
     122    _owl_keymap_format_with_parents(km, fm);
    123123  } else {
    124124    _owl_keymap_format_bindings(km, fm);
     
    126126}
    127127
    128 static void _owl_keymap_format_with_submaps(const owl_keymap *km, owl_fmtext *fm)
     128static void _owl_keymap_format_with_parents(const owl_keymap *km, owl_fmtext *fm)
    129129{
    130130  while (km) {
    131131    _owl_keymap_format_bindings(km, fm);
    132     km = km->submap;
     132    km = km->parent;
    133133    if (km) {
    134134      owl_fmtext_append_bold(fm, "\nInherited from ");
     
    273273  }
    274274
    275   /* deal with the always_fn for the map and submaps */
    276   for (km=kh->active; km; km=km->submap) {
     275  /* deal with the always_fn for the map and parents */
     276  for (km=kh->active; km; km=km->parent) {
    277277    if (km->prealways_fn) {
    278278      km->prealways_fn(j);
     
    281281
    282282  /* search for a match.  goes through active keymap and then
    283    * through submaps... TODO:  clean this up so we can pull
     283   * through parents... TODO:  clean this up so we can pull
    284284   * keyhandler and keymap apart.  */
    285   for (km=kh->active; km; km=km->submap) {
     285  for (km=kh->active; km; km=km->parent) {
    286286    for (i=owl_list_get_size(&km->bindings)-1; i>=0; i--) {
    287287      kb = owl_list_get_element(&km->bindings, i);
  • keys.c

    r8a5b5a1 r44cc9ab  
    3030       "Text editing and command window",
    3131       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    32   owl_keymap_set_submap(km_editwin, km_global);
     32  owl_keymap_set_parent(km_editwin, km_global);
    3333  /*
    3434  BIND_CMD("F1",          "help",            "");
     
    9999       "Multi-line text editing",
    100100       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    101   owl_keymap_set_submap(km_ew_multi, km_editwin);
     101  owl_keymap_set_parent(km_ew_multi, km_editwin);
    102102
    103103  BIND_CMD("UP",      "edit:move-up-line", "");
     
    129129       "Single-line text editing",
    130130       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    131   owl_keymap_set_submap(km_ew_onel, km_editwin);
     131  owl_keymap_set_parent(km_ew_onel, km_editwin);
    132132
    133133  BIND_CMD("C-u",         "edit:delete-all", "Clears the entire line");
     
    154154       "Single-line response to question",
    155155       owl_keys_editwin_default, NULL, owl_keys_editwin_postalways);
    156   owl_keymap_set_submap(km_ew_onel, km_editwin);
     156  owl_keymap_set_parent(km_ew_onel, km_editwin);
    157157
    158158  BIND_CMD("C-u",         "edit:delete-all", "Clears the entire line");
     
    169169       "Pop-up window (eg, help)",
    170170       owl_keys_default_invalid, NULL, owl_keys_popless_postalways);
    171   owl_keymap_set_submap(km_viewwin, km_global);
     171  owl_keymap_set_parent(km_viewwin, km_global);
    172172
    173173  BIND_CMD("SPACE",       "popless:scroll-down-page", "");
     
    222222        "Main window / message list",
    223223        owl_keys_default_invalid, owl_keys_recwin_prealways, NULL);
    224   owl_keymap_set_submap(km_mainwin, km_global);
     224  owl_keymap_set_parent(km_mainwin, km_global);
    225225  BIND_CMD("C-x C-c", "start-command quit", "");
    226226  BIND_CMD("F1",      "help",           "");
  • owl.h

    r20aced3 r44cc9ab  
    476476  char     *desc;               /* description */
    477477  owl_list  bindings;           /* key bindings */
    478   const struct _owl_keymap *submap;     /* submap */
     478  const struct _owl_keymap *parent;     /* parent */
    479479  void (*default_fn)(owl_input j);      /* default action (takes a keypress) */
    480480  void (*prealways_fn)(owl_input  j);   /* always called before a keypress is received */
Note: See TracChangeset for help on using the changeset viewer.