Skip to content

Commit

Permalink
vty_cli: add forward word handler
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Oct 28, 2010
1 parent 22b4b6b commit f0d25d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vty_cli.c
Expand Up @@ -161,6 +161,15 @@ static void knet_vty_backward_word(struct knet_vty *vty)
knet_vty_backward_char(vty);
}

static void knet_vty_forward_word(struct knet_vty *vty)
{
while(vty->cursor_pos != vty->line_idx && vty->line[vty->cursor_pos] == ' ')
knet_vty_forward_char(vty);

while(vty->cursor_pos != vty->line_idx && vty->line[vty->cursor_pos] != ' ')
knet_vty_forward_char(vty);
}

static void knet_vty_backward_kill_word(struct knet_vty *vty)
{
while(vty->cursor_pos > 0 && vty->line[vty->cursor_pos - 1] == ' ')
Expand Down Expand Up @@ -219,7 +228,7 @@ static int knet_vty_process_buf(struct knet_vty *vty, unsigned char *buf, int bu
break;
case 'f':
vty->escape = VTY_NORMAL;
log_info("forward word");
knet_vty_forward_word(vty);
break;
case 'd':
vty->escape = VTY_NORMAL;
Expand Down

0 comments on commit f0d25d7

Please sign in to comment.