Karsten Hopp af9cd0
To: vim_dev@googlegroups.com
Karsten Hopp af9cd0
Subject: Patch 7.3.338
Karsten Hopp af9cd0
Fcc: outbox
Karsten Hopp af9cd0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp af9cd0
Mime-Version: 1.0
Karsten Hopp af9cd0
Content-Type: text/plain; charset=UTF-8
Karsten Hopp af9cd0
Content-Transfer-Encoding: 8bit
Karsten Hopp af9cd0
------------
Karsten Hopp af9cd0
Karsten Hopp af9cd0
Patch 7.3.338
Karsten Hopp af9cd0
Problem:    Using getchar() in an expression mapping doesn't work well.
Karsten Hopp af9cd0
Solution:   Don't save and restore the typeahead. (James Vega)
Karsten Hopp af9cd0
Files:	    src/getchar.c, src/testdir/test34.ok
Karsten Hopp af9cd0
Karsten Hopp af9cd0
Karsten Hopp af9cd0
*** ../vim-7.3.337/src/getchar.c	2011-08-17 20:33:18.000000000 +0200
Karsten Hopp af9cd0
--- src/getchar.c	2011-10-12 21:53:27.000000000 +0200
Karsten Hopp af9cd0
***************
Karsten Hopp af9cd0
*** 2460,2486 ****
Karsten Hopp af9cd0
  
Karsten Hopp af9cd0
  			/*
Karsten Hopp af9cd0
  			 * Handle ":map <expr>": evaluate the {rhs} as an
Karsten Hopp af9cd0
! 			 * expression.  Save and restore the typeahead so that
Karsten Hopp af9cd0
! 			 * getchar() can be used.  Also save and restore the
Karsten Hopp af9cd0
! 			 * command line for "normal :".
Karsten Hopp af9cd0
  			 */
Karsten Hopp af9cd0
  			if (mp->m_expr)
Karsten Hopp af9cd0
  			{
Karsten Hopp af9cd0
- 			    tasave_T	tabuf;
Karsten Hopp af9cd0
  			    int		save_vgetc_busy = vgetc_busy;
Karsten Hopp af9cd0
  
Karsten Hopp af9cd0
! 			    save_typeahead(&tabuf);
Karsten Hopp af9cd0
! 			    if (tabuf.typebuf_valid)
Karsten Hopp af9cd0
! 			    {
Karsten Hopp af9cd0
! 				vgetc_busy = 0;
Karsten Hopp af9cd0
! 				save_m_keys = vim_strsave(mp->m_keys);
Karsten Hopp af9cd0
! 				save_m_str = vim_strsave(mp->m_str);
Karsten Hopp af9cd0
! 				s = eval_map_expr(save_m_str, NUL);
Karsten Hopp af9cd0
! 				vgetc_busy = save_vgetc_busy;
Karsten Hopp af9cd0
! 			    }
Karsten Hopp af9cd0
! 			    else
Karsten Hopp af9cd0
! 				s = NULL;
Karsten Hopp af9cd0
! 			    restore_typeahead(&tabuf);
Karsten Hopp af9cd0
  			}
Karsten Hopp af9cd0
  			else
Karsten Hopp af9cd0
  #endif
Karsten Hopp af9cd0
--- 2460,2477 ----
Karsten Hopp af9cd0
  
Karsten Hopp af9cd0
  			/*
Karsten Hopp af9cd0
  			 * Handle ":map <expr>": evaluate the {rhs} as an
Karsten Hopp af9cd0
! 			 * expression.  Also save and restore the command line
Karsten Hopp af9cd0
! 			 * for "normal :".
Karsten Hopp af9cd0
  			 */
Karsten Hopp af9cd0
  			if (mp->m_expr)
Karsten Hopp af9cd0
  			{
Karsten Hopp af9cd0
  			    int		save_vgetc_busy = vgetc_busy;
Karsten Hopp af9cd0
  
Karsten Hopp af9cd0
! 			    vgetc_busy = 0;
Karsten Hopp af9cd0
! 			    save_m_keys = vim_strsave(mp->m_keys);
Karsten Hopp af9cd0
! 			    save_m_str = vim_strsave(mp->m_str);
Karsten Hopp af9cd0
! 			    s = eval_map_expr(save_m_str, NUL);
Karsten Hopp af9cd0
! 			    vgetc_busy = save_vgetc_busy;
Karsten Hopp af9cd0
  			}
Karsten Hopp af9cd0
  			else
Karsten Hopp af9cd0
  #endif
Karsten Hopp af9cd0
*** ../vim-7.3.337/src/testdir/test34.ok	2010-08-15 21:57:29.000000000 +0200
Karsten Hopp af9cd0
--- src/testdir/test34.ok	2011-10-12 21:59:39.000000000 +0200
Karsten Hopp af9cd0
***************
Karsten Hopp af9cd0
*** 1,5 ****
Karsten Hopp af9cd0
  xxx4asdf fail nop ok 9 333
Karsten Hopp af9cd0
! XX111XX
Karsten Hopp af9cd0
  ---222---
Karsten Hopp af9cd0
  1. one
Karsten Hopp af9cd0
  2. two
Karsten Hopp af9cd0
--- 1,5 ----
Karsten Hopp af9cd0
  xxx4asdf fail nop ok 9 333
Karsten Hopp af9cd0
! XX111-XX
Karsten Hopp af9cd0
  ---222---
Karsten Hopp af9cd0
  1. one
Karsten Hopp af9cd0
  2. two
Karsten Hopp af9cd0
*** ../vim-7.3.337/src/version.c	2011-10-12 21:04:15.000000000 +0200
Karsten Hopp af9cd0
--- src/version.c	2011-10-12 21:20:31.000000000 +0200
Karsten Hopp af9cd0
***************
Karsten Hopp af9cd0
*** 711,712 ****
Karsten Hopp af9cd0
--- 711,714 ----
Karsten Hopp af9cd0
  {   /* Add new patch number below this line */
Karsten Hopp af9cd0
+ /**/
Karsten Hopp af9cd0
+     338,
Karsten Hopp af9cd0
  /**/
Karsten Hopp af9cd0
Karsten Hopp af9cd0
-- 
Karsten Hopp af9cd0
hundred-and-one symptoms of being an internet addict:
Karsten Hopp af9cd0
65. The last time you looked at the clock it was 11:30pm, and in what
Karsten Hopp af9cd0
    seems like only a few seconds later, your sister runs past you to
Karsten Hopp af9cd0
    catch her 7am school bus.
Karsten Hopp af9cd0
Karsten Hopp af9cd0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp af9cd0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp af9cd0
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp af9cd0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///