Skip to content

Commit

Permalink
vty_cli: fix refresh when adding in the middle of the buffer
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 b155cf3 commit 203cd06
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vty_cli.c
Expand Up @@ -29,10 +29,7 @@ static void knet_vty_reset_buf(struct knet_vty *vty)
static void knet_vty_add_to_buf(struct knet_vty *vty, unsigned char *buf, int pos)
{
char outbuf[2];

outbuf[0] = buf[pos];
outbuf[1] = 0;
knet_vty_write(vty, "%s", outbuf);
int i;

if (vty->cursor_pos == vty->line_idx) {
vty->line[vty->line_idx] = buf[pos];
Expand All @@ -43,6 +40,12 @@ static void knet_vty_add_to_buf(struct knet_vty *vty, unsigned char *buf, int po
}
vty->line_idx++;
vty->cursor_pos++;

outbuf[0] = buf[pos];
outbuf[1] = 0;
knet_vty_write(vty, "%s%s", outbuf, &vty->line[vty->cursor_pos]);
for (i = 0; i < (vty->line_idx - vty->cursor_pos); i++)
knet_vty_write(vty, "%s", telnet_backward_char);
}

/*
Expand Down

0 comments on commit 203cd06

Please sign in to comment.