1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Using getchar() in an expression mapping doesn't work well.
12 Solution: Don't save and restore the typeahead. (James Vega)
13 Files: src/getchar.c, src/testdir/test34.ok
16 *** ../vim-7.3.337/src/getchar.c 2011-08-17 20:33:18.000000000 +0200
17 --- src/getchar.c 2011-10-12 21:53:27.000000000 +0200
22 * Handle ":map <expr>": evaluate the {rhs} as an
23 ! * expression. Save and restore the typeahead so that
24 ! * getchar() can be used. Also save and restore the
25 ! * command line for "normal :".
30 int save_vgetc_busy = vgetc_busy;
32 ! save_typeahead(&tabuf);
33 ! if (tabuf.typebuf_valid)
36 ! save_m_keys = vim_strsave(mp->m_keys);
37 ! save_m_str = vim_strsave(mp->m_str);
38 ! s = eval_map_expr(save_m_str, NUL);
39 ! vgetc_busy = save_vgetc_busy;
43 ! restore_typeahead(&tabuf);
50 * Handle ":map <expr>": evaluate the {rhs} as an
51 ! * expression. Also save and restore the command line
56 int save_vgetc_busy = vgetc_busy;
59 ! save_m_keys = vim_strsave(mp->m_keys);
60 ! save_m_str = vim_strsave(mp->m_str);
61 ! s = eval_map_expr(save_m_str, NUL);
62 ! vgetc_busy = save_vgetc_busy;
66 *** ../vim-7.3.337/src/testdir/test34.ok 2010-08-15 21:57:29.000000000 +0200
67 --- src/testdir/test34.ok 2011-10-12 21:59:39.000000000 +0200
70 xxx4asdf fail nop ok 9 333
76 xxx4asdf fail nop ok 9 333
81 *** ../vim-7.3.337/src/version.c 2011-10-12 21:04:15.000000000 +0200
82 --- src/version.c 2011-10-12 21:20:31.000000000 +0200
86 { /* Add new patch number below this line */
92 hundred-and-one symptoms of being an internet addict:
93 65. The last time you looked at the clock it was 11:30pm, and in what
94 seems like only a few seconds later, your sister runs past you to
95 catch her 7am school bus.
97 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
98 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
99 \\\ an exciting new programming language -- http://www.Zimbu.org ///
100 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///