04b6737
To: vim-dev@vim.org
04b6737
Subject: Patch 7.2.079
04b6737
Fcc: outbox
04b6737
From: Bram Moolenaar <Bram@moolenaar.net>
04b6737
Mime-Version: 1.0
04b6737
Content-Type: text/plain; charset=ISO-8859-1
04b6737
Content-Transfer-Encoding: 8bit
04b6737
------------
04b6737
04b6737
Patch 7.2.079
04b6737
Problem:    "killed" netbeans events are not handled correctly.
04b6737
Solution:   A "killed" netbeans event is sent when the buffer is deleted or
04b6737
	    wiped out (in this case, the netbeans annotations in this buffer
04b6737
	    have been removed).  A user can still remove a sign with the
04b6737
	    command ":sign unplace" and this does not trigger a "killed"
04b6737
	    event.  (Xavier de Gaye)
04b6737
Files:	    runtime/doc/netbeans.txt, src/buffer.c, src/globals.h,
04b6737
	    src/netbeans.c, src/proto/netbeans.pro
04b6737
04b6737
04b6737
*** ../vim-7.2.078/runtime/doc/netbeans.txt	Sat Aug  9 19:36:49 2008
04b6737
--- runtime/doc/netbeans.txt	Tue Jan  6 15:23:39 2009
04b6737
***************
04b6737
*** 1,4 ****
04b6737
! *netbeans.txt*  For Vim version 7.2.  Last change: 2008 Jun 28
04b6737
  
04b6737
  
04b6737
  		  VIM REFERENCE MANUAL    by Gordon Prieur et al.
04b6737
--- 1,4 ----
04b6737
! *netbeans.txt*  For Vim version 7.2.  Last change: 2009 Jan 06
04b6737
  
04b6737
  
04b6737
  		  VIM REFERENCE MANUAL    by Gordon Prieur et al.
04b6737
***************
04b6737
*** 722,729 ****
04b6737
  		of the cursor.
04b6737
  		New in version 2.1.
04b6737
  
04b6737
! killed		A file was closed by the user.  Only for files that have been
04b6737
! 		assigned a number by the IDE.
04b6737
  
04b6737
  newDotAndMark off off
04b6737
  		Reports the position of the cursor being at "off" bytes into
04b6737
--- 722,731 ----
04b6737
  		of the cursor.
04b6737
  		New in version 2.1.
04b6737
  
04b6737
! killed		A file was deleted or wiped out by the user and the buffer
04b6737
! 		annotations have been removed.  The bufID number for this
04b6737
! 		buffer has become invalid.  Only for files that have been
04b6737
! 		assigned a bufID number by the IDE.
04b6737
  
04b6737
  newDotAndMark off off
04b6737
  		Reports the position of the cursor being at "off" bytes into
04b6737
*** ../vim-7.2.078/src/buffer.c	Wed Dec  3 11:21:20 2008
04b6737
--- src/buffer.c	Tue Jan  6 15:23:02 2009
04b6737
***************
04b6737
*** 437,446 ****
04b6737
  	return;
04b6737
  #endif
04b6737
  
04b6737
- #ifdef FEAT_NETBEANS_INTG
04b6737
-     if (usingNetbeans)
04b6737
- 	netbeans_file_closed(buf);
04b6737
- #endif
04b6737
      /* Change directories when the 'acd' option is set. */
04b6737
      DO_AUTOCHDIR
04b6737
  
04b6737
--- 437,442 ----
04b6737
***************
04b6737
*** 639,644 ****
04b6737
--- 635,644 ----
04b6737
  #ifdef FEAT_SIGNS
04b6737
      buf_delete_signs(buf);		/* delete any signs */
04b6737
  #endif
04b6737
+ #ifdef FEAT_NETBEANS_INTG
04b6737
+     if (usingNetbeans)
04b6737
+         netbeans_file_killed(buf);
04b6737
+ #endif
04b6737
  #ifdef FEAT_LOCALMAP
04b6737
      map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE);  /* clear local mappings */
04b6737
      map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE);   /* clear local abbrevs */
04b6737
***************
04b6737
*** 815,823 ****
04b6737
      int		bnr;		/* buffer number */
04b6737
      char_u	*p;
04b6737
  
04b6737
- #ifdef FEAT_NETBEANS_INTG
04b6737
-     netbeansCloseFile = 1;
04b6737
- #endif
04b6737
      if (addr_count == 0)
04b6737
      {
04b6737
  	(void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
04b6737
--- 815,820 ----
04b6737
***************
04b6737
*** 912,920 ****
04b6737
  	}
04b6737
      }
04b6737
  
04b6737
- #ifdef FEAT_NETBEANS_INTG
04b6737
-     netbeansCloseFile = 0;
04b6737
- #endif
04b6737
  
04b6737
      return errormsg;
04b6737
  }
04b6737
--- 909,914 ----
04b6737
*** ../vim-7.2.078/src/globals.h	Fri Nov 28 21:26:50 2008
04b6737
--- src/globals.h	Tue Jan  6 15:23:02 2009
04b6737
***************
04b6737
*** 1340,1346 ****
04b6737
  
04b6737
  #ifdef FEAT_NETBEANS_INTG
04b6737
  EXTERN char *netbeansArg INIT(= NULL);	/* the -nb[:host:port:passwd] arg */
04b6737
- EXTERN int netbeansCloseFile INIT(= 0);	/* send killed if != 0 */
04b6737
  EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
04b6737
  EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
04b6737
  EXTERN int netbeansReadFile INIT(= 1);	/* OK to read from disk if != 0 */
04b6737
--- 1340,1345 ----
04b6737
*** ../vim-7.2.078/src/netbeans.c	Wed Dec 24 12:20:10 2008
04b6737
--- src/netbeans.c	Tue Jan  6 15:23:02 2009
04b6737
***************
04b6737
*** 2921,2964 ****
04b6737
  }
04b6737
  
04b6737
  /*
04b6737
!  * Tell netbeans a file was closed.
04b6737
   */
04b6737
      void
04b6737
! netbeans_file_closed(buf_T *bufp)
04b6737
  {
04b6737
      int		bufno = nb_getbufno(bufp);
04b6737
      nbbuf_T	*nbbuf = nb_get_buf(bufno);
04b6737
      char	buffer[2*MAXPATHL];
04b6737
  
04b6737
!     if (!haveConnection || bufno < 0)
04b6737
  	return;
04b6737
  
04b6737
!     if (!netbeansCloseFile)
04b6737
!     {
04b6737
! 	nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
04b6737
! 		    bufp->b_ffname));
04b6737
! 	return;
04b6737
!     }
04b6737
! 
04b6737
!     nbdebug(("netbeans_file_closed:\n"));
04b6737
!     nbdebug(("    Closing bufno: %d", bufno));
04b6737
!     if (curbuf != NULL && curbuf != bufp)
04b6737
!     {
04b6737
! 	nbdebug(("    Curbuf bufno:  %d\n", nb_getbufno(curbuf)));
04b6737
!     }
04b6737
!     else if (curbuf == bufp)
04b6737
!     {
04b6737
! 	nbdebug(("    curbuf == bufp\n"));
04b6737
!     }
04b6737
! 
04b6737
!     if (bufno <= 0)
04b6737
! 	return;
04b6737
  
04b6737
      sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
04b6737
  
04b6737
      nbdebug(("EVT: %s", buffer));
04b6737
  
04b6737
!     nb_send(buffer, "netbeans_file_closed");
04b6737
  
04b6737
      if (nbbuf != NULL)
04b6737
  	nbbuf->bufp = NULL;
04b6737
--- 2921,2946 ----
04b6737
  }
04b6737
  
04b6737
  /*
04b6737
!  * Tell netbeans that a file was deleted or wiped out.
04b6737
   */
04b6737
      void
04b6737
! netbeans_file_killed(buf_T *bufp)
04b6737
  {
04b6737
      int		bufno = nb_getbufno(bufp);
04b6737
      nbbuf_T	*nbbuf = nb_get_buf(bufno);
04b6737
      char	buffer[2*MAXPATHL];
04b6737
  
04b6737
!     if (!haveConnection || bufno == -1)
04b6737
  	return;
04b6737
  
04b6737
!     nbdebug(("netbeans_file_killed:\n"));
04b6737
!     nbdebug(("    Killing bufno: %d", bufno));
04b6737
  
04b6737
      sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
04b6737
  
04b6737
      nbdebug(("EVT: %s", buffer));
04b6737
  
04b6737
!     nb_send(buffer, "netbeans_file_killed");
04b6737
  
04b6737
      if (nbbuf != NULL)
04b6737
  	nbbuf->bufp = NULL;
04b6737
*** ../vim-7.2.078/src/proto/netbeans.pro	Tue Jun 24 23:25:53 2008
04b6737
--- src/proto/netbeans.pro	Tue Jan  6 15:23:02 2009
04b6737
***************
04b6737
*** 11,17 ****
04b6737
  void netbeans_frame_moved __ARGS((int new_x, int new_y));
04b6737
  void netbeans_file_activated __ARGS((buf_T *bufp));
04b6737
  void netbeans_file_opened __ARGS((buf_T *bufp));
04b6737
! void netbeans_file_closed __ARGS((buf_T *bufp));
04b6737
  void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
04b6737
  void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
04b6737
  void netbeans_unmodified __ARGS((buf_T *bufp));
04b6737
--- 11,17 ----
04b6737
  void netbeans_frame_moved __ARGS((int new_x, int new_y));
04b6737
  void netbeans_file_activated __ARGS((buf_T *bufp));
04b6737
  void netbeans_file_opened __ARGS((buf_T *bufp));
04b6737
! void netbeans_file_killed __ARGS((buf_T *bufp));
04b6737
  void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
04b6737
  void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
04b6737
  void netbeans_unmodified __ARGS((buf_T *bufp));
04b6737
*** ../vim-7.2.078/src/version.c	Tue Jan  6 15:01:58 2009
04b6737
--- src/version.c	Tue Jan  6 16:11:11 2009
04b6737
***************
04b6737
*** 678,679 ****
04b6737
--- 678,681 ----
04b6737
  {   /* Add new patch number below this line */
04b6737
+ /**/
04b6737
+     79,
04b6737
  /**/
04b6737
04b6737
-- 
04b6737
Friends?  I have lots of friends!  In fact, I have every episode ever made.
04b6737
04b6737
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
04b6737
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
04b6737
\\\        download, build and distribute -- http://www.A-A-P.org        ///
04b6737
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///