Karsten Hopp bc0894
To: vim-dev@vim.org
Karsten Hopp bc0894
Subject: patch 7.0.177
Karsten Hopp bc0894
Fcc: outbox
Karsten Hopp bc0894
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp bc0894
Mime-Version: 1.0
Karsten Hopp bc0894
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp bc0894
Content-Transfer-Encoding: 8bit
Karsten Hopp bc0894
------------
Karsten Hopp bc0894
Karsten Hopp bc0894
Patch 7.0.177
Karsten Hopp bc0894
Problem:    When the press-enter prompt gets a character from a non-remappable
Karsten Hopp bc0894
	    mapping, it's put back in the typeahead buffer as remappable,
Karsten Hopp bc0894
	    which may cause an endless loop.
Karsten Hopp bc0894
Solution:   Restore the non-remappable flag and the silent flag when putting a
Karsten Hopp bc0894
	    char back in the typeahead buffer.
Karsten Hopp bc0894
Files:	    src/getchar.c, src/message.c, src/normal.c
Karsten Hopp bc0894
Karsten Hopp bc0894
Karsten Hopp bc0894
*** ../vim-7.0.176/src/getchar.c	Tue Oct  3 15:36:09 2006
Karsten Hopp bc0894
--- src/getchar.c	Tue Dec  5 21:17:42 2006
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 76,82 ****
Karsten Hopp bc0894
   */
Karsten Hopp bc0894
  static mapblock_T	*first_abbr = NULL; /* first entry in abbrlist */
Karsten Hopp bc0894
  
Karsten Hopp bc0894
! static int		KeyNoremap = FALSE; /* remapping disabled */
Karsten Hopp bc0894
  
Karsten Hopp bc0894
  /*
Karsten Hopp bc0894
   * variables used by vgetorpeek() and flush_buffers()
Karsten Hopp bc0894
--- 76,82 ----
Karsten Hopp bc0894
   */
Karsten Hopp bc0894
  static mapblock_T	*first_abbr = NULL; /* first entry in abbrlist */
Karsten Hopp bc0894
  
Karsten Hopp bc0894
! static int		KeyNoremap = 0;	    /* remapping flags */
Karsten Hopp bc0894
  
Karsten Hopp bc0894
  /*
Karsten Hopp bc0894
   * variables used by vgetorpeek() and flush_buffers()
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 1035,1040 ****
Karsten Hopp bc0894
--- 1037,1044 ----
Karsten Hopp bc0894
  /*
Karsten Hopp bc0894
   * Put character "c" back into the typeahead buffer.
Karsten Hopp bc0894
   * Can be used for a character obtained by vgetc() that needs to be put back.
Karsten Hopp bc0894
+  * Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to
Karsten Hopp bc0894
+  * the char.
Karsten Hopp bc0894
   */
Karsten Hopp bc0894
      void
Karsten Hopp bc0894
  ins_char_typebuf(c)
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 1061,1067 ****
Karsten Hopp bc0894
  	buf[1] = NUL;
Karsten Hopp bc0894
  #endif
Karsten Hopp bc0894
      }
Karsten Hopp bc0894
!     (void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
Karsten Hopp bc0894
  }
Karsten Hopp bc0894
  
Karsten Hopp bc0894
  /*
Karsten Hopp bc0894
--- 1065,1071 ----
Karsten Hopp bc0894
  	buf[1] = NUL;
Karsten Hopp bc0894
  #endif
Karsten Hopp bc0894
      }
Karsten Hopp bc0894
!     (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
Karsten Hopp bc0894
  }
Karsten Hopp bc0894
  
Karsten Hopp bc0894
  /*
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 2270,2278 ****
Karsten Hopp bc0894
  					gotchars(typebuf.tb_buf
Karsten Hopp bc0894
  							 + typebuf.tb_off, 1);
Karsten Hopp bc0894
  				    }
Karsten Hopp bc0894
! 				    KeyNoremap = (typebuf.tb_noremap[
Karsten Hopp bc0894
! 						   typebuf.tb_off]
Karsten Hopp bc0894
! 						       & (RM_NONE|RM_SCRIPT));
Karsten Hopp bc0894
  				    del_typebuf(1, 0);
Karsten Hopp bc0894
  				}
Karsten Hopp bc0894
  				break;	    /* got character, break for loop */
Karsten Hopp bc0894
--- 2276,2283 ----
Karsten Hopp bc0894
  					gotchars(typebuf.tb_buf
Karsten Hopp bc0894
  							 + typebuf.tb_off, 1);
Karsten Hopp bc0894
  				    }
Karsten Hopp bc0894
! 				    KeyNoremap = typebuf.tb_noremap[
Karsten Hopp bc0894
! 							      typebuf.tb_off];
Karsten Hopp bc0894
  				    del_typebuf(1, 0);
Karsten Hopp bc0894
  				}
Karsten Hopp bc0894
  				break;	    /* got character, break for loop */
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 4196,4202 ****
Karsten Hopp bc0894
  
Karsten Hopp bc0894
      if (typebuf.tb_no_abbr_cnt)	/* abbrev. are not recursive */
Karsten Hopp bc0894
  	return FALSE;
Karsten Hopp bc0894
!     if (KeyNoremap)		/* no remapping implies no abbreviation */
Karsten Hopp bc0894
  	return FALSE;
Karsten Hopp bc0894
  
Karsten Hopp bc0894
      /*
Karsten Hopp bc0894
--- 4201,4208 ----
Karsten Hopp bc0894
  
Karsten Hopp bc0894
      if (typebuf.tb_no_abbr_cnt)	/* abbrev. are not recursive */
Karsten Hopp bc0894
  	return FALSE;
Karsten Hopp bc0894
!     if ((KeyNoremap & (RM_NONE|RM_SCRIPT)) != 0)
Karsten Hopp bc0894
! 	/* no remapping implies no abbreviation */
Karsten Hopp bc0894
  	return FALSE;
Karsten Hopp bc0894
  
Karsten Hopp bc0894
      /*
Karsten Hopp bc0894
*** ../vim-7.0.176/src/normal.c	Tue Nov  7 18:43:10 2006
Karsten Hopp bc0894
--- src/normal.c	Tue Dec  5 21:16:07 2006
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 651,659 ****
Karsten Hopp bc0894
  	/* Fake a "c"hange command.  When "restart_edit" is set (e.g., because
Karsten Hopp bc0894
  	 * 'insertmode' is set) fake a "d"elete command, Insert mode will
Karsten Hopp bc0894
  	 * restart automatically.
Karsten Hopp bc0894
! 	 * Insert the typed character in the typeahead buffer, so that it will
Karsten Hopp bc0894
! 	 * be mapped in Insert mode.  Required for ":lmap" to work.  May cause
Karsten Hopp bc0894
! 	 * mapping a character from ":vnoremap"... */
Karsten Hopp bc0894
  	ins_char_typebuf(c);
Karsten Hopp bc0894
  	if (restart_edit != 0)
Karsten Hopp bc0894
  	    c = 'd';
Karsten Hopp bc0894
--- 651,658 ----
Karsten Hopp bc0894
  	/* Fake a "c"hange command.  When "restart_edit" is set (e.g., because
Karsten Hopp bc0894
  	 * 'insertmode' is set) fake a "d"elete command, Insert mode will
Karsten Hopp bc0894
  	 * restart automatically.
Karsten Hopp bc0894
! 	 * Insert the typed character in the typeahead buffer, so that it can
Karsten Hopp bc0894
! 	 * be mapped in Insert mode.  Required for ":lmap" to work. */
Karsten Hopp bc0894
  	ins_char_typebuf(c);
Karsten Hopp bc0894
  	if (restart_edit != 0)
Karsten Hopp bc0894
  	    c = 'd';
Karsten Hopp bc0894
*** ../vim-7.0.176/src/version.c	Tue Dec  5 21:32:00 2006
Karsten Hopp bc0894
--- src/version.c	Tue Dec  5 21:36:07 2006
Karsten Hopp bc0894
***************
Karsten Hopp bc0894
*** 668,669 ****
Karsten Hopp bc0894
--- 668,671 ----
Karsten Hopp bc0894
  {   /* Add new patch number below this line */
Karsten Hopp bc0894
+ /**/
Karsten Hopp bc0894
+     177,
Karsten Hopp bc0894
  /**/
Karsten Hopp bc0894
Karsten Hopp bc0894
-- 
Karsten Hopp bc0894
5 out of 4 people have trouble with fractions.
Karsten Hopp bc0894
Karsten Hopp bc0894
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp bc0894
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp bc0894
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp bc0894
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///