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