From: Daniel Carl Date: Wed, 26 Nov 2014 22:09:51 +0000 (+0100) Subject: Fixed ^V^V shown in showcmd of statusbar. X-Git-Url: https://git.owens.tech/assets/static/git.owens.tech/assets/static/git.owens.tech/git?a=commitdiff_plain;h=4cc691737f7fb4287042cc79a3ace0a57e0a58f2;p=vimb.git Fixed ^V^V shown in showcmd of statusbar. The showcmd is completely controlled by map.c and any external call to map_showcmd() lead to duplicate printed showcmd chars. --- diff --git a/src/map.c b/src/map.c index 470584a..081f772 100644 --- 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; diff --git a/src/map.h b/src/map.h index a02e3db..a08dfce 100644 --- 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 */ diff --git a/src/mode.c b/src/mode.c index 42a8996..19c6779 100644 --- a/src/mode.c +++ b/src/mode.c @@ -20,7 +20,6 @@ #include "config.h" #include "main.h" #include "mode.h" -#include "map.h" #include "ascii.h" #include @@ -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; }