getchar() in map-<expr> break internal state.
Steps to reproduce:
$ gvim -u NONE (I tested on Windows)
:nnoremap <expr> x getchar()
Then, type "x" and "<C-Space>" (any key with modifier)
Now, all mappings does not work.
In the vgetc(), no_mapping and allow_keys are restored wrongly.
getchar.c:vgetc()
1633 if (mod_mask) /* no mapping after modifier has been
read */
1634 {
1635 ++no_mapping;
1636 ++allow_keys;
1637 }
1638 c = vgetorpeek(TRUE); <- getchar() in map <expr> change
mod_mask
1639 if (mod_mask)
1640 {
1641 --no_mapping;
1642 --allow_keys;
1643 }
Please check the following patch.
diff --git a/src/getchar.c b/src/getchar.c
index a80432f..acf1c2f 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4659,6 +4659,7 @@ eval_map_expr(str, c)
pos_T save_cursor;
int save_msg_col;
int save_msg_row;
+ int save_mod_mask;
/* Remove escaping of CSI, because "str" is in a format to be used as
* typeahead. */
@@ -4684,6 +4685,7 @@ eval_map_expr(str, c)
save_cursor = curwin->w_cursor;
save_msg_col = msg_col;
save_msg_row = msg_row;
+ save_mod_mask = mod_mask; /* getchar() may change mod_mask */
p = eval_to_string(expr, NULL, FALSE);
--textlock;
#ifdef FEAT_EX_EXTRA
@@ -4692,6 +4694,7 @@ eval_map_expr(str, c)
curwin->w_cursor = save_cursor;
msg_col = save_msg_col;
msg_row = save_msg_row;
+ mod_mask = save_mod_mask;
restore_cmdline_alloc(save_cmd);
vim_free(expr);
--
Yukihiro Nakadaira - [email protected]
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.