home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.215 < prev    next >
Encoding:
Internet Message Format  |  2004-01-29  |  5.3 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.215
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.215
  11. Problem:    NetBeans: problems saving an unmodified file.
  12. Solution:   Add isNetbeansModified() function.  Disable netbeans_unmodified().
  13.         (Gordon Prieur)
  14. Files:        src/fileio.c, src/netbeans.c, src/proto/netbeans.pro,
  15.         runtime/doc/netbeans.txt, runtime/doc/tags
  16.  
  17.  
  18. *** ../vim-6.2.214/src/fileio.c    Sun Jan 25 20:45:55 2004
  19. --- src/fileio.c    Fri Jan 30 20:15:37 2004
  20. ***************
  21. *** 2663,2669 ****
  22.       {
  23.       if (whole)
  24.       {
  25. !         if (buf->b_changed)
  26.           {
  27.           netbeans_save_buffer(buf);
  28.           return retval;
  29. --- 2663,2673 ----
  30.       {
  31.       if (whole)
  32.       {
  33. !         /*
  34. !          * b_changed can be 0 after an undo, but we still need to write
  35. !          * the buffer to NetBeans.
  36. !          */
  37. !         if (buf->b_changed || isNetbeansModified(buf))
  38.           {
  39.           netbeans_save_buffer(buf);
  40.           return retval;
  41. *** ../vim-6.2.214/src/netbeans.c    Sun Jan 25 19:40:26 2004
  42. --- src/netbeans.c    Fri Jan 30 20:45:18 2004
  43. ***************
  44. *** 785,790 ****
  45. --- 785,810 ----
  46.   }
  47.   
  48.   /*
  49. +  * NetBeans and Vim have different undo models. In Vim, the file isn't
  50. +  * changed if changes are undone via the undo command. In NetBeans, once
  51. +  * a change has been made the file is marked as modified until saved. It
  52. +  * doesn't matter if the change was undone.
  53. +  *
  54. +  * So this function is for the corner case where Vim thinks a buffer is
  55. +  * unmodified but NetBeans thinks it IS modified.
  56. +  */
  57. +     int
  58. + isNetbeansModified(buf_T *bufp)
  59. + {
  60. +     int bufno = nb_getbufno(bufp);
  61. +     if (bufno > 0)
  62. +     return buf_list[bufno].modified;
  63. +     else
  64. +     return FALSE;
  65. + }
  66. + /*
  67.    * Given a Netbeans buffer number, return the netbeans buffer.
  68.    * Returns NULL for 0 or a negative number. A 0 bufno means a
  69.    * non-buffer related command has been sent.
  70. ***************
  71. *** 1496,1501 ****
  72. --- 1516,1524 ----
  73.           return FAIL;
  74.           }
  75.           buf->fireChanges = 0;
  76. +         if (buf->bufp != NULL && !buf->bufp->b_netbeans_file)
  77. +         EMSGN(_("E658: NetBeans connection lost for buffer %ld"),
  78. +                                buf->bufp->b_fnum);
  79.   /* =====================================================================*/
  80.       }
  81.       else if (streq((char *)cmd, "setTitle"))
  82. ***************
  83. *** 2504,2516 ****
  84. --- 2527,2543 ----
  85.   /*
  86.    * Send netbeans an unmodufied command.
  87.    */
  88. + /*ARGSUSED*/
  89.       void
  90.   netbeans_unmodified(buf_T *bufp)
  91.   {
  92. + #if 0
  93.       char_u    buf[128];
  94.       int        bufno;
  95.       nbbuf_T    *nbbuf;
  96.   
  97. +     /* This has been disabled, because NetBeans considers a buffer modified
  98. +      * even when all changes have been undone. */
  99.       nbbuf = nb_bufp2nbbuf_fire(bufp, &bufno);
  100.       if (nbbuf == NULL)
  101.       return;
  102. ***************
  103. *** 2520,2525 ****
  104. --- 2547,2553 ----
  105.       sprintf((char *)buf, "%d:unmodified=%d\n", bufno, cmdno);
  106.       nbdebug(("EVT: %s", buf));
  107.       nb_send((char *)buf, "netbeans_unmodified");
  108. + #endif
  109.   }
  110.   
  111.   /*
  112. *** ../vim-6.2.214/src/proto/netbeans.pro    Sun Jan 18 21:31:56 2004
  113. --- src/proto/netbeans.pro    Fri Jan 30 20:15:58 2004
  114. ***************
  115. *** 4,9 ****
  116. --- 4,10 ----
  117.   void netbeans_w32_connect __ARGS((void));
  118.   void messageFromNetbeansW32 __ARGS((void));
  119.   int isNetbeansBuffer __ARGS((buf_T *bufp));
  120. + int isNetbeansModified __ARGS((buf_T *bufp));
  121.   void netbeans_end __ARGS((void));
  122.   void netbeans_startup_done __ARGS((void));
  123.   void netbeans_frame_moved __ARGS((int new_x, int new_y));
  124. *** ../vim-6.2.214/runtime/doc/netbeans.txt    Sun Jan 18 21:31:56 2004
  125. --- runtime/doc/netbeans.txt    Fri Jan 30 20:16:10 2004
  126. ***************
  127. *** 189,194 ****
  128. --- 189,202 ----
  129.           NetBeans does not support partial writes for buffers that were
  130.           opened from NetBeans.
  131.   
  132. +                             *E658*
  133. + NetBeans connection lost for this buffer
  134. +         NetBeans has become confused about the state of this file.
  135. +         Rather than risc data corruption, NetBeans has severed the
  136. +         connection for this file. Vim will take over responsibility
  137. +         for saving changes to this file and NetBeans will no longer
  138. +         know of these changes.
  139.   ==============================================================================
  140.   9. Running Vim from NetBeans                *netbeans-run*
  141.   
  142. *** ../vim-6.2.214/runtime/doc/tags    Sun Jan 18 21:19:56 2004
  143. --- runtime/doc/tags    Fri Jan 30 20:40:22 2004
  144. ***************
  145. *** 3420,3425 ****
  146. --- 3454,3463 ----
  147.   E652    netbeans.txt    /*E652*
  148.   E653    netbeans.txt    /*E653*
  149.   E654    netbeans.txt    /*E654*
  150. + E655    eval.txt    /*E655*
  151. + E656    netbeans.txt    /*E656*
  152. + E657    netbeans.txt    /*E657*
  153. + E658    netbeans.txt    /*E658*
  154.   E66    syntax.txt    /*E66*
  155.   E67    syntax.txt    /*E67*
  156.   E68    pattern.txt    /*E68*
  157. *** ../vim-6.2.214/src/version.c    Wed Jan  1 01:32:06 2003
  158. --- src/version.c    Fri Jan 30 21:00:52 2004
  159. ***************
  160. *** 639,640 ****
  161. --- 639,642 ----
  162.   {   /* Add new patch number below this line */
  163. + /**/
  164. +     215,
  165.   /**/
  166.  
  167. -- 
  168. I learned the customs and mannerisms of engineers by observing them, much the
  169. way Jane Goodall learned about the great apes, but without the hassle of
  170. grooming.
  171.                 (Scott Adams - The Dilbert principle)
  172.  
  173.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  174. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  175. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  176.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  177.