]>
Commit | Line | Data |
---|---|---|
05649561 AG |
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 | + | |
62 | + if (bufno > 0) | |
63 | + return buf_list[bufno].modified; | |
64 | + else | |
65 | + return FALSE; | |
66 | + } | |
67 | + | |
68 | + /* | |
69 | * Given a Netbeans buffer number, return the netbeans buffer. | |
70 | * Returns NULL for 0 or a negative number. A 0 bufno means a | |
71 | * non-buffer related command has been sent. | |
72 | *************** | |
73 | *** 1496,1501 **** | |
74 | --- 1516,1524 ---- | |
75 | return FAIL; | |
76 | } | |
77 | buf->fireChanges = 0; | |
78 | + if (buf->bufp != NULL && !buf->bufp->b_netbeans_file) | |
79 | + EMSGN(_("E658: NetBeans connection lost for buffer %ld"), | |
80 | + buf->bufp->b_fnum); | |
81 | /* =====================================================================*/ | |
82 | } | |
83 | else if (streq((char *)cmd, "setTitle")) | |
84 | *************** | |
85 | *** 2504,2516 **** | |
86 | --- 2527,2543 ---- | |
87 | /* | |
88 | * Send netbeans an unmodufied command. | |
89 | */ | |
90 | + /*ARGSUSED*/ | |
91 | void | |
92 | netbeans_unmodified(buf_T *bufp) | |
93 | { | |
94 | + #if 0 | |
95 | char_u buf[128]; | |
96 | int bufno; | |
97 | nbbuf_T *nbbuf; | |
98 | ||
99 | + /* This has been disabled, because NetBeans considers a buffer modified | |
100 | + * even when all changes have been undone. */ | |
101 | nbbuf = nb_bufp2nbbuf_fire(bufp, &bufno); | |
102 | if (nbbuf == NULL) | |
103 | return; | |
104 | *************** | |
105 | *** 2520,2525 **** | |
106 | --- 2547,2553 ---- | |
107 | sprintf((char *)buf, "%d:unmodified=%d\n", bufno, cmdno); | |
108 | nbdebug(("EVT: %s", buf)); | |
109 | nb_send((char *)buf, "netbeans_unmodified"); | |
110 | + #endif | |
111 | } | |
112 | ||
113 | /* | |
114 | *** ../vim-6.2.214/src/proto/netbeans.pro Sun Jan 18 21:31:56 2004 | |
115 | --- src/proto/netbeans.pro Fri Jan 30 20:15:58 2004 | |
116 | *************** | |
117 | *** 4,9 **** | |
118 | --- 4,10 ---- | |
119 | void netbeans_w32_connect __ARGS((void)); | |
120 | void messageFromNetbeansW32 __ARGS((void)); | |
121 | int isNetbeansBuffer __ARGS((buf_T *bufp)); | |
122 | + int isNetbeansModified __ARGS((buf_T *bufp)); | |
123 | void netbeans_end __ARGS((void)); | |
124 | void netbeans_startup_done __ARGS((void)); | |
125 | void netbeans_frame_moved __ARGS((int new_x, int new_y)); | |
126 | *** ../vim-6.2.214/runtime/doc/netbeans.txt Sun Jan 18 21:31:56 2004 | |
127 | --- runtime/doc/netbeans.txt Fri Jan 30 20:16:10 2004 | |
128 | *************** | |
129 | *** 189,194 **** | |
130 | --- 189,202 ---- | |
131 | NetBeans does not support partial writes for buffers that were | |
132 | opened from NetBeans. | |
133 | ||
134 | + *E658* | |
135 | + NetBeans connection lost for this buffer | |
136 | + NetBeans has become confused about the state of this file. | |
137 | + Rather than risc data corruption, NetBeans has severed the | |
138 | + connection for this file. Vim will take over responsibility | |
139 | + for saving changes to this file and NetBeans will no longer | |
140 | + know of these changes. | |
141 | + | |
142 | ============================================================================== | |
143 | 9. Running Vim from NetBeans *netbeans-run* | |
144 | ||
145 | *** ../vim-6.2.214/runtime/doc/tags Sun Jan 18 21:19:56 2004 | |
146 | --- runtime/doc/tags Fri Jan 30 20:40:22 2004 | |
147 | *************** | |
148 | *** 3420,3425 **** | |
149 | --- 3454,3463 ---- | |
150 | E652 netbeans.txt /*E652* | |
151 | E653 netbeans.txt /*E653* | |
152 | E654 netbeans.txt /*E654* | |
153 | + E655 eval.txt /*E655* | |
154 | + E656 netbeans.txt /*E656* | |
155 | + E657 netbeans.txt /*E657* | |
156 | + E658 netbeans.txt /*E658* | |
157 | E66 syntax.txt /*E66* | |
158 | E67 syntax.txt /*E67* | |
159 | E68 pattern.txt /*E68* | |
160 | *** ../vim-6.2.214/src/version.c Wed Jan 1 01:32:06 2003 | |
161 | --- src/version.c Fri Jan 30 21:00:52 2004 | |
162 | *************** | |
163 | *** 639,640 **** | |
164 | --- 639,642 ---- | |
165 | { /* Add new patch number below this line */ | |
166 | + /**/ | |
167 | + 215, | |
168 | /**/ | |
169 | ||
170 | -- | |
171 | I learned the customs and mannerisms of engineers by observing them, much the | |
172 | way Jane Goodall learned about the great apes, but without the hassle of | |
173 | grooming. | |
174 | (Scott Adams - The Dilbert principle) | |
175 | ||
176 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
177 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
178 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
179 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |