Use SHOWCMD_LEN to be the number of chars without NULL byte.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 19 Oct 2013 14:45:06 +0000 (16:45 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 19 Oct 2013 14:45:06 +0000 (16:45 +0200)
src/normal.c

index 788f351..26e4dc5 100644 (file)
@@ -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);
         }