From: Daniel Carl Date: Sat, 19 Oct 2013 14:45:06 +0000 (+0200) Subject: Use SHOWCMD_LEN to be the number of chars without NULL byte. X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=984557301975191cfe3006e7aca33639349ac2b8;p=vimb.git Use SHOWCMD_LEN to be the number of chars without NULL byte. --- diff --git a/src/normal.c b/src/normal.c index 788f351..26e4dc5 100644 --- a/src/normal.c +++ b/src/normal.c @@ -206,7 +206,7 @@ static struct { extern VbCore vb; -static char showcmd_buf[SHOWCMD_LEN]; /* buffer to show ambiguous key sequence */ +static char showcmd_buf[SHOWCMD_LEN + 1]; /* buffer to show ambiguous key sequence */ /** * Function called when vimb enters the normal mode. @@ -290,7 +290,7 @@ void normal_showcmd(int c) translated = transchar(c); old = strlen(showcmd_buf); extra = strlen(translated); - overflow = old + extra - SHOWCMD_LEN + 1; + overflow = old + extra - SHOWCMD_LEN; if (overflow > 0) { g_memmove(showcmd_buf, showcmd_buf + overflow, old - overflow + 1); }