diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-07 21:33:12 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-07 21:33:12 +0000 |
commit | 5555acc08e6f49afe00cbb8fefd687cb526a7cf2 (patch) | |
tree | d69b430164cd7a178e597fc07741c4d4a3d825be /src/getchar.c | |
parent | 7b89edc62ddb12b74276567087f58fc015c1f8a0 (diff) |
updated for version 7.0c12
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/getchar.c b/src/getchar.c index 07c595f26a..60a2a9b420 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1822,7 +1822,7 @@ vgetorpeek(advance) * Using ":normal" can also do this, but it saves the typeahead buffer, * thus it should be OK. But don't get a key from the user then. */ - if (vgetc_busy + if (vgetc_busy > 0 #ifdef FEAT_EX_EXTRA && ex_normal_busy == 0 #endif @@ -1831,7 +1831,7 @@ vgetorpeek(advance) local_State = get_real_state(); - vgetc_busy = TRUE; + ++vgetc_busy; if (advance) KeyStuffed = FALSE; @@ -2316,10 +2316,25 @@ vgetorpeek(advance) #ifdef FEAT_EVAL /* * Handle ":map <expr>": evaluate the {rhs} as an - * expression. + * expression. Save and restore the typeahead so that + * getchar() can be used. */ if (mp->m_expr) - s = eval_to_string(mp->m_str, NULL, FALSE); + { + tasave_T tabuf; + int save_vgetc_busy = vgetc_busy; + + save_typeahead(&tabuf); + if (tabuf.typebuf_valid) + { + vgetc_busy = 0; + s = eval_to_string(mp->m_str, NULL, FALSE); + vgetc_busy = save_vgetc_busy; + } + else + s = NULL; + restore_typeahead(&tabuf); + } else #endif s = mp->m_str; @@ -2689,7 +2704,7 @@ vgetorpeek(advance) gui_update_cursor(TRUE, FALSE); #endif - vgetc_busy = FALSE; + --vgetc_busy; return c; } |