--- libaitcli/example/t.c 2010/06/04 09:16:59 1.1.2.3 +++ libaitcli/example/t.c 2011/03/16 17:24:03 1.2 @@ -221,7 +221,8 @@ bufBS(int idx, void * __restrict buffer) buf->line_eol--; buf->line_len--; - memmove(buf->line_buf + buf->line_eol, buf->line_buf + buf->line_eol + 1, + memmove(buf->line_buf + buf->line_eol - buf->line_bol, + buf->line_buf + buf->line_eol - buf->line_bol + 1, buf->line_len - buf->line_eol); buf->line_buf[buf->line_len - 1] = 0; @@ -243,9 +244,8 @@ bufBTAB(int idx, void * __restrict buffer) if (buf->line_bol < buf->line_eol) { clrscrEOL(buf); - buf->line_eol--; - buf->line_len--; - buf->line_buf[buf->line_eol - buf->line_bol] = 0; + buf->line_len = buf->line_eol - buf->line_bol + 1; + buf->line_buf[buf->line_len - 1] = 0; printfEOL(buf, -1, 1); } @@ -332,7 +332,8 @@ bufDel(int idx, void * __restrict buffer) clrscrEOL(buf); buf->line_len--; - memmove(buf->line_buf + buf->line_eol, buf->line_buf + buf->line_eol + 1, + memmove(buf->line_buf + buf->line_eol - buf->line_bol, + buf->line_buf + buf->line_eol - buf->line_bol + 1, buf->line_len - buf->line_eol); buf->line_buf[buf->line_len - 1] = 0; @@ -802,7 +803,7 @@ main() { int ret; bindkey_t key = { sizeof K_TAB - 1, K_TAB, bufTab }; - linebuffer_t *buffer = initCLI(STDIN_FILENO, STDOUT_FILENO, /*CLI_PROMPT*/ NULL); + linebuffer_t *buffer = initCLI(STDIN_FILENO, STDOUT_FILENO, CLI_PROMPT); bindKeyCLI(&key, buffer);