Show
Ignore:
Timestamp:
03/13/09 14:52:58 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1236955978 +0000
git-parent:

[56c7e9dd00981d9018a28e7adf1fb6144821c51e]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1236955978 +0000
Message:

more complete tab completion, refs #37

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_console_complete.c

    r56c7e9d rfc52ce1  
    2626                          int idx) { 
    2727  int i; 
    28   noit_skiplist_node *next
     28  noit_skiplist_node *next, *curr
    2929  cmd_info_t *cmd; 
    3030 
     
    4141 
    4242  cmd = noit_skiplist_find_neighbors(&state->cmds, argv[0], 
    43                                      NULL, NULL, &next); 
     43                                     NULL, &curr, &next); 
    4444  if(cmd) { 
    45     if(argc == 1) { 
    46       if(idx == 0) return strdup(cmd->name); 
    47       return NULL; 
    48     } 
    49     if(!cmd->autocomplete) return NULL; 
    50     return cmd->autocomplete(ncct, stack, cmd->dstate, argc-1, argv+1, idx); 
    51   } 
    52  
     45    if(argc != 1) { 
     46      if(!cmd->autocomplete) return NULL; 
     47      return cmd->autocomplete(ncct, stack, cmd->dstate, argc-1, argv+1, idx); 
     48    } 
     49    next = curr; 
     50    goto multiples; 
     51  } 
     52 
     53 multiples: 
    5354  if(!next) return NULL; 
    5455  i = 0; 
    5556  while(next) { 
    5657    cmd = next->data; 
    57     if(strncasecmp(cmd->name, argv[0], strlen(argv[0])) == 0) 
     58    if(strncasecmp(cmd->name, argv[0], strlen(argv[0])) == 0) { 
    5859      if(idx == i) return strdup(cmd->name); 
    59     i++; 
     60      i++; 
     61    } 
    6062    noit_skiplist_next(&state->cmds, &next); 
    6163  } 
     
    178180unsigned char 
    179181noit_edit_complete(EditLine *el, int invoking_key) { 
    180   static const char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("; 
     182  static const char *rl_basic_word_break_characters = " \t\n\"\\'@$><=;|&{("; 
    181183  static const char *rl_special_prefixes = NULL; 
    182184  static const int   rl_completion_append_character = ' ';