summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-21 23:32:32 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-21 23:32:32 +0100
commit25281634cda03ce302aaf9f906a9520b5f81f91e (patch)
treeccc62740f7af898d7be19893f8972baf3aa3013f /src
parentd6357e8f93c50f984ffd69c3a0d247d8603f86c3 (diff)
patch 7.4.1150v7.4.1150
Problem: 'langmap' applies to the first character typed in Select mode. (David Watson) Solution: Check for SELECTMODE. (Christian Brabandt, closes #572) Add the 'x' flag to feedkeys().
Diffstat (limited to 'src')
-rw-r--r--src/ex_docmd.c23
-rw-r--r--src/getchar.c3
-rw-r--r--src/normal.c2
-rw-r--r--src/proto/ex_docmd.pro1
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_langmap.vim24
-rw-r--r--src/version.c2
7 files changed, 47 insertions, 9 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 837d135218..5c61679d7b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10226,17 +10226,26 @@ exec_normal_cmd(cmd, remap, silent)
int remap;
int silent;
{
+ /* Stuff the argument into the typeahead buffer. */
+ ins_typebuf(cmd, remap, 0, TRUE, silent);
+ exec_normal(FALSE);
+}
+#endif
+
+#if defined(FEAT_EX_EXTRA) || defined(FEAT_MENU) || defined(FEAT_EVAL) \
+ || defined(PROTO)
+/*
+ * Execute normal_cmd() until there is no typeahead left.
+ */
+ void
+exec_normal(int was_typed)
+{
oparg_T oa;
- /*
- * Stuff the argument into the typeahead buffer.
- * Execute normal_cmd() until there is no typeahead left.
- */
clear_oparg(&oa);
finish_op = FALSE;
- ins_typebuf(cmd, remap, 0, TRUE, silent);
- while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
- && !got_int)
+ while ((!stuff_empty() || ((was_typed || !typebuf_typed())
+ && typebuf.tb_len > 0)) && !got_int)
{
update_topline_cursor();
normal_cmd(&oa, TRUE); /* execute a Normal mode cmd */
diff --git a/src/getchar.c b/src/getchar.c
index 70829e18ef..5b5eab3871 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2149,7 +2149,8 @@ vgetorpeek(advance)
else
{
LANGMAP_ADJUST(c1,
- (State & (CMDLINE | INSERT)) == 0);
+ (State & (CMDLINE | INSERT)) == 0
+ && get_real_state() != SELECTMODE);
nolmaplen = 0;
}
#endif
diff --git a/src/normal.c b/src/normal.c
index ac1a391f26..17cb8d6b8e 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -638,7 +638,7 @@ normal_cmd(oap, toplevel)
* Get the command character from the user.
*/
c = safe_vgetc();
- LANGMAP_ADJUST(c, TRUE);
+ LANGMAP_ADJUST(c, get_real_state() != SELECTMODE);
/*
* If a mapping was started in Visual or Select mode, remember the length
diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro
index f4d4347250..15e5fc5c04 100644
--- a/src/proto/ex_docmd.pro
+++ b/src/proto/ex_docmd.pro
@@ -50,6 +50,7 @@ int vim_mkdir_emsg(char_u *name, int prot);
FILE *open_exfile(char_u *fname, int forceit, char *mode);
void update_topline_cursor(void);
void exec_normal_cmd(char_u *cmd, int remap, int silent);
+void exec_normal(int was_typed);
int find_cmdline_var(char_u *src, int *usedlen);
char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char_u **errormsg, int *escaped);
char_u *expand_sfile(char_u *arg);
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index d02e8d2b40..d7a06eeb47 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -173,6 +173,7 @@ NEW_TESTS = test_arglist.res \
test_cdo.res \
test_hardcopy.res \
test_increment.res \
+ test_langmap.res \
test_perl.res \
test_quickfix.res \
test_syntax.res \
diff --git a/src/testdir/test_langmap.vim b/src/testdir/test_langmap.vim
new file mode 100644
index 0000000000..066c3bf2bd
--- /dev/null
+++ b/src/testdir/test_langmap.vim
@@ -0,0 +1,24 @@
+" tests for 'langmap'
+
+func Test_langmap()
+ new
+ set langmap=}l,^x,%v
+
+ call setline(1, ['abc'])
+ call feedkeys('gg0}^', 'tx')
+ call assert_equal('ac', getline(1))
+
+ " in Replace mode
+ " need silent! to avoid a delay when entering Insert mode
+ call setline(1, ['abcde'])
+ silent! call feedkeys("gg0lR%{z\<Esc>00", 'tx')
+ call assert_equal('a%{ze', getline(1))
+
+ " in Select mode
+ " need silent! to avoid a delay when entering Insert mode
+ call setline(1, ['abcde'])
+ silent! call feedkeys("gg0}%}\<C-G>}^\<Esc>00", 'tx')
+ call assert_equal('a}^de', getline(1))
+
+ quit!
+endfunc
diff --git a/src/version.c b/src/version.c
index 96e0105fb5..6aee23d435 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1150,
+/**/
1149,
/**/
1148,