Fixed ^V^V shown in showcmd of statusbar.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 26 Nov 2014 22:09:51 +0000 (23:09 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 26 Nov 2014 22:14:46 +0000 (23:14 +0100)
The showcmd is completely controlled by map.c and any external call to
map_showcmd() lead to duplicate printed showcmd chars.

src/map.c
src/map.h
src/mode.c

index 470584a..081f772 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -48,6 +48,7 @@ static struct {
 
 extern VbCore vb;
 
+static void showcmd(int c);
 static char *transchar(int c);
 static gboolean map_delete_by_lhs(const char *lhs, int len, char mode);
 static int keyval_to_string(guint keyval, guint state, guchar *string);
@@ -227,12 +228,12 @@ MapState map_handle_keys(const guchar *keys, int keylen, gboolean use_map)
 
             /* send the key to the parser */
             if (RESULT_MORE != mode_handle_key((int)qk)) {
-                map_showcmd(0);
+                showcmd(0);
                 showlen = 0;
             } else if (showlen > 0) {
                 showlen--;
             } else {
-                map_showcmd(qk);
+                showcmd(qk);
             }
         }
 
@@ -261,7 +262,7 @@ MapState map_handle_keys(const guchar *keys, int keylen, gboolean use_map)
                         /* appen only those chars that are not already in showcmd */
                         i += showlen;
                         while (i < map.qlen) {
-                            map_showcmd(map.queue[i++]);
+                            showcmd(map.queue[i++]);
                             showlen++;
                         }
                     }
@@ -291,7 +292,7 @@ MapState map_handle_keys(const guchar *keys, int keylen, gboolean use_map)
             /* flush the show command to make room for possible mapped command
              * chars to show for example if :nmap foo 12g is use we want to
              * display the incomplete 12g command */
-            map_showcmd(0);
+            showcmd(0);
             showlen = 0;
 
             if (match->inlen < match->mappedlen) {
@@ -370,7 +371,7 @@ gboolean map_delete(const char *in, char mode)
 /**
  * Put the given char onto the show command buffer.
  */
-void map_showcmd(int c)
+static void showcmd(int c)
 {
     char *translated;
     int old, extra, overflow;
index a02e3db..a08dfce 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -38,6 +38,5 @@ MapState map_handle_keys(const guchar *keys, int keylen, gboolean use_map);
 void map_handle_string(const char *str, gboolean use_map);
 void map_insert(const char *in, const char *mapped, char mode, gboolean remap);
 gboolean map_delete(const char *in, char mode);
-void map_showcmd(int c);
 
 #endif /* end of include guard: _MAP_H */
index 42a8996..19c6779 100644 (file)
@@ -20,7 +20,6 @@
 #include "config.h"
 #include "main.h"
 #include "mode.h"
-#include "map.h"
 #include "ascii.h"
 #include <glib.h>
 
@@ -133,7 +132,6 @@ VbResult mode_handle_key(int key)
     if (vb.mode->id != 'p' && key == CTRL('V')) {
         vb.mode->flags |= FLAG_NOMAP;
         ctrl_v = true;
-        map_showcmd(key);
 
         return RESULT_MORE;
     }