components/vim/vim72-patches/7.2.334
changeset 379 c6a17bba1da3
parent 378 f0b61ed1d10d
child 380 e92b3b4a1c66
--- a/components/vim/vim72-patches/7.2.334	Thu Jul 07 19:05:29 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-To: [email protected]
-Subject: Patch 7.2.334
-Fcc: outbox
-From: Bram Moolenaar <[email protected]>
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.2.334
-Problem:    Postponing keys in Netbeans interface does not work properly.
-Solution:   Store the key string instead of the number.  Avoid an infinite
-	    loop. (Mostly by Xavier de Gaye)
-Files:	    src/netbeans.c, src/proto/netbeans.pro
-
-
-*** ../vim-7.2.333/src/netbeans.c	2010-01-19 14:59:14.000000000 +0100
---- src/netbeans.c	2010-01-19 15:12:17.000000000 +0100
-***************
-*** 70,76 ****
-  static pos_T *off2pos __ARGS((buf_T *, long));
-  static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
-  static long get_buf_size __ARGS((buf_T *));
-! static void netbeans_keystring __ARGS((int key, char *keystr));
-  static void special_keys __ARGS((char_u *args));
-  
-  static void netbeans_connect __ARGS((void));
---- 70,77 ----
-  static pos_T *off2pos __ARGS((buf_T *, long));
-  static pos_T *get_off_or_lnum __ARGS((buf_T *buf, char_u **argp));
-  static long get_buf_size __ARGS((buf_T *));
-! static int netbeans_keystring __ARGS((char_u *keystr));
-! static void postpone_keycommand __ARGS((char_u *keystr));
-  static void special_keys __ARGS((char_u *args));
-  
-  static void netbeans_connect __ARGS((void));
-***************
-*** 502,508 ****
-  
-  struct keyqueue
-  {
-!     int		     key;
-      struct keyqueue *next;
-      struct keyqueue *prev;
-  };
---- 503,509 ----
-  
-  struct keyqueue
-  {
-!     char_u	    *keystr;
-      struct keyqueue *next;
-      struct keyqueue *prev;
-  };
-***************
-*** 514,526 ****
-  
-  /*
-   * Queue up key commands sent from netbeans.
-   */
-      static void
-! postpone_keycommand(int key)
-  {
-      keyQ_T *node;
-  
-      node = (keyQ_T *)alloc(sizeof(keyQ_T));
-  
-      if (keyHead.next == NULL) /* initialize circular queue */
-      {
---- 515,531 ----
-  
-  /*
-   * Queue up key commands sent from netbeans.
-+  * We store the string, because it may depend on the global mod_mask and
-+  * :nbkey doesn't have a key number.
-   */
-      static void
-! postpone_keycommand(char_u *keystr)
-  {
-      keyQ_T *node;
-  
-      node = (keyQ_T *)alloc(sizeof(keyQ_T));
-+     if (node == NULL)
-+ 	return;  /* out of memory, drop the key */
-  
-      if (keyHead.next == NULL) /* initialize circular queue */
-      {
-***************
-*** 534,540 ****
-      keyHead.prev->next = node;
-      keyHead.prev = node;
-  
-!     node->key = key;
-  }
-  
-  /*
---- 539,545 ----
-      keyHead.prev->next = node;
-      keyHead.prev = node;
-  
-!     node->keystr = vim_strsave(keystr);
-  }
-  
-  /*
-***************
-*** 543,557 ****
-      static void
-  handle_key_queue(void)
-  {
-!     while (keyHead.next && keyHead.next != &keyHead)
-      {
-  	/* first, unlink the node */
-  	keyQ_T *node = keyHead.next;
-  	keyHead.next = node->next;
-  	node->next->prev = node->prev;
-  
-! 	/* now, send the keycommand */
-! 	netbeans_keycommand(node->key);
-  
-  	/* Finally, dispose of the node */
-  	vim_free(node);
---- 548,567 ----
-      static void
-  handle_key_queue(void)
-  {
-!     int postponed = FALSE;
-! 
-!     while (!postponed && keyHead.next && keyHead.next != &keyHead)
-      {
-  	/* first, unlink the node */
-  	keyQ_T *node = keyHead.next;
-  	keyHead.next = node->next;
-  	node->next->prev = node->prev;
-  
-! 	/* Now, send the keycommand.  This may cause it to be postponed again
-! 	 * and change keyHead. */
-! 	if (node->keystr != NULL)
-! 	    postponed = !netbeans_keystring(node->keystr);
-! 	vim_free(node->keystr);
-  
-  	/* Finally, dispose of the node */
-  	vim_free(node);
-***************
-*** 2495,2501 ****
-  	    }
-  	    else
-  	    {
-! 	        nbdebug(("    Buffer has no changes!\n"));
-  	    }
-  /* =====================================================================*/
-  	}
---- 2505,2511 ----
-  	    }
-  	    else
-  	    {
-! 		nbdebug(("    Buffer has no changes!\n"));
-  	    }
-  /* =====================================================================*/
-  	}
-***************
-*** 2658,2664 ****
-  ex_nbkey(eap)
-      exarg_T	*eap;
-  {
-!     netbeans_keystring(0, (char *)eap->arg);
-  }
-  
-  
---- 2668,2674 ----
-  ex_nbkey(eap)
-      exarg_T	*eap;
-  {
-!     (void)netbeans_keystring(eap->arg);
-  }
-  
-  
-***************
-*** 2680,2686 ****
-  }
-  
-  /*
-!  * Convert key to netbeans name.
-   */
-      static void
-  netbeans_keyname(int key, char *buf)
---- 2690,2696 ----
-  }
-  
-  /*
-!  * Convert key to netbeans name.  This uses the global "mod_mask".
-   */
-      static void
-  netbeans_keyname(int key, char *buf)
-***************
-*** 3127,3149 ****
-  /*
-   * Send a keypress event back to netbeans. This usually simulates some
-   * kind of function key press. This function operates on a key code.
-   */
-!     void
-  netbeans_keycommand(int key)
-  {
-      char	keyName[60];
-  
-      netbeans_keyname(key, keyName);
-!     netbeans_keystring(key, keyName);
-  }
-  
-  
-  /*
-   * Send a keypress event back to netbeans. This usually simulates some
-   * kind of function key press. This function operates on a key string.
-   */
-!     static void
-! netbeans_keystring(int key, char *keyName)
-  {
-      char	buf[2*MAXPATHL];
-      int		bufno = nb_getbufno(curbuf);
---- 3137,3163 ----
-  /*
-   * Send a keypress event back to netbeans. This usually simulates some
-   * kind of function key press. This function operates on a key code.
-+  * Return TRUE when the key was sent, FALSE when the command has been
-+  * postponed.
-   */
-!     int
-  netbeans_keycommand(int key)
-  {
-      char	keyName[60];
-  
-      netbeans_keyname(key, keyName);
-!     return netbeans_keystring((char_u *)keyName);
-  }
-  
-  
-  /*
-   * Send a keypress event back to netbeans. This usually simulates some
-   * kind of function key press. This function operates on a key string.
-+  * Return TRUE when the key was sent, FALSE when the command has been
-+  * postponed.
-   */
-!     static int
-! netbeans_keystring(char_u *keyName)
-  {
-      char	buf[2*MAXPATHL];
-      int		bufno = nb_getbufno(curbuf);
-***************
-*** 3151,3157 ****
-      char_u	*q;
-  
-      if (!haveConnection)
-! 	return;
-  
-  
-      if (bufno == -1)
---- 3165,3171 ----
-      char_u	*q;
-  
-      if (!haveConnection)
-! 	return TRUE;
-  
-  
-      if (bufno == -1)
-***************
-*** 3160,3166 ****
-  	q = curbuf->b_ffname == NULL ? (char_u *)""
-  						 : nb_quote(curbuf->b_ffname);
-  	if (q == NULL)
-! 	    return;
-  	vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
-  		q,
-  		"T",  /* open in NetBeans */
---- 3174,3180 ----
-  	q = curbuf->b_ffname == NULL ? (char_u *)""
-  						 : nb_quote(curbuf->b_ffname);
-  	if (q == NULL)
-! 	    return TRUE;
-  	vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0,
-  		q,
-  		"T",  /* open in NetBeans */
-***************
-*** 3170,3178 ****
-  	nbdebug(("EVT: %s", buf));
-  	nb_send(buf, "netbeans_keycommand");
-  
-! 	if (key > 0)
-! 	    postpone_keycommand(key);
-! 	return;
-      }
-  
-      /* sync the cursor position */
---- 3184,3191 ----
-  	nbdebug(("EVT: %s", buf));
-  	nb_send(buf, "netbeans_keycommand");
-  
-! 	postpone_keycommand(keyName);
-! 	return FALSE;
-      }
-  
-      /* sync the cursor position */
-***************
-*** 3198,3203 ****
---- 3211,3217 ----
-  		off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col);
-      nbdebug(("EVT: %s", buf));
-      nb_send(buf, "netbeans_keycommand");
-+     return TRUE;
-  }
-  
-  
-*** ../vim-7.2.333/src/proto/netbeans.pro	2009-01-06 16:13:42.000000000 +0100
---- src/proto/netbeans.pro	2010-01-19 13:31:01.000000000 +0100
-***************
-*** 16,22 ****
-  void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
-  void netbeans_unmodified __ARGS((buf_T *bufp));
-  void netbeans_button_release __ARGS((int button));
-! void netbeans_keycommand __ARGS((int key));
-  void netbeans_save_buffer __ARGS((buf_T *bufp));
-  void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
-  int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
---- 16,22 ----
-  void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
-  void netbeans_unmodified __ARGS((buf_T *bufp));
-  void netbeans_button_release __ARGS((int button));
-! int netbeans_keycommand __ARGS((int key));
-  void netbeans_save_buffer __ARGS((buf_T *bufp));
-  void netbeans_deleted_all_lines __ARGS((buf_T *bufp));
-  int netbeans_is_guarded __ARGS((linenr_T top, linenr_T bot));
-*** ../vim-7.2.333/src/version.c	2010-01-19 14:59:14.000000000 +0100
---- src/version.c	2010-01-19 15:08:44.000000000 +0100
-***************
-*** 683,684 ****
---- 683,686 ----
-  {   /* Add new patch number below this line */
-+ /**/
-+     334,
-  /**/
-
--- 
-hundred-and-one symptoms of being an internet addict:
-119. You are reading a book and look for the scroll bar to get to
-     the next page.
-
- /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
-///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\        download, build and distribute -- http://www.A-A-P.org        ///
- \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///