comparison src/getchar.c @ 3135:7919a3d7333b v7.3.338

updated for version 7.3.338 Problem: Using getchar() in an expression mapping doesn't work well. Solution: Don't save and restore the typeahead. (James Vega)
author Bram Moolenaar <bram@vim.org>
date Wed, 12 Oct 2011 22:02:14 +0200
parents 27d43855b723
children 910eb66c9768
comparison
equal deleted inserted replaced
3134:e8f3119f5d09 3135:7919a3d7333b
2458 save_m_keys = NULL; /* only saved when needed */ 2458 save_m_keys = NULL; /* only saved when needed */
2459 save_m_str = NULL; /* only saved when needed */ 2459 save_m_str = NULL; /* only saved when needed */
2460 2460
2461 /* 2461 /*
2462 * Handle ":map <expr>": evaluate the {rhs} as an 2462 * Handle ":map <expr>": evaluate the {rhs} as an
2463 * expression. Save and restore the typeahead so that 2463 * expression. Also save and restore the command line
2464 * getchar() can be used. Also save and restore the 2464 * for "normal :".
2465 * command line for "normal :".
2466 */ 2465 */
2467 if (mp->m_expr) 2466 if (mp->m_expr)
2468 { 2467 {
2469 tasave_T tabuf;
2470 int save_vgetc_busy = vgetc_busy; 2468 int save_vgetc_busy = vgetc_busy;
2471 2469
2472 save_typeahead(&tabuf); 2470 vgetc_busy = 0;
2473 if (tabuf.typebuf_valid) 2471 save_m_keys = vim_strsave(mp->m_keys);
2474 { 2472 save_m_str = vim_strsave(mp->m_str);
2475 vgetc_busy = 0; 2473 s = eval_map_expr(save_m_str, NUL);
2476 save_m_keys = vim_strsave(mp->m_keys); 2474 vgetc_busy = save_vgetc_busy;
2477 save_m_str = vim_strsave(mp->m_str);
2478 s = eval_map_expr(save_m_str, NUL);
2479 vgetc_busy = save_vgetc_busy;
2480 }
2481 else
2482 s = NULL;
2483 restore_typeahead(&tabuf);
2484 } 2475 }
2485 else 2476 else
2486 #endif 2477 #endif
2487 s = mp->m_str; 2478 s = mp->m_str;
2488 2479