To: vim-dev@vim.org Subject: Patch 6.2.199 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.199 (after 6.2.194) Problem: Vim doesn't work perfectly well with NetBeans. Solution: When NetBeans saves the file, reset the timestamp to avoid "file changed" warnings. Close a buffer in a proper way. Don't try giving a debug message with an invalid pointer. Send a newDotAndMark message when needed. Report a change by the "r" command to NetBeans. (Gordon Prieur) Files: src/netbeans.c, src/normal.c *** ../vim-6.2.198/src/netbeans.c Sun Jan 18 21:31:56 2004 --- src/netbeans.c Wed Jan 21 10:58:28 2004 *************** *** 1655,1661 **** --- 1655,1670 ---- if (streq((char *)args, "T")) buf->bufp->b_changed = 1; else + { + struct stat st; + + /* Assume NetBeans stored the file. Reset the timestamp to + * avoid "file changed" warnings. */ + if (buf->bufp->b_ffname != NULL + && mch_stat((char *)buf->bufp->b_ffname, &st) >= 0) + buf_store_time(buf->bufp, &st, buf->bufp->b_ffname); buf->bufp->b_changed = 0; + } buf->modified = buf->bufp->b_changed; /* =====================================================================*/ } *************** *** 1759,1765 **** nbdebug((" CLOSE %d: %s\n", bufno, name)); need_mouse_correct = TRUE; if (buf->bufp != NULL) ! close_buffer(NULL, buf->bufp, 0); doupdate = 1; /* =====================================================================*/ } --- 1768,1775 ---- nbdebug((" CLOSE %d: %s\n", bufno, name)); need_mouse_correct = TRUE; if (buf->bufp != NULL) ! do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, ! buf->bufp->b_fnum, TRUE); doupdate = 1; /* =====================================================================*/ } *************** *** 2336,2342 **** nbbuf_T *nbbuf = nb_get_buf(bufno); char buffer[2*MAXPATHL]; ! if (!haveConnection) return; if (!netbeansCloseFile) --- 2346,2352 ---- nbbuf_T *nbbuf = nb_get_buf(bufno); char buffer[2*MAXPATHL]; ! if (!haveConnection || bufno < 0) return; if (!netbeansCloseFile) *************** *** 2526,2535 **** if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) { - int lnum = curwin->w_cursor.lnum; int col = mouse_col - curwin->w_wincol - (curwin->w_p_nu ? 9 : 1); ! sprintf(buf, "%d:buttonRelease=%d %d %d %d\n", bufno, cmdno, button, lnum, col); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_button_release"); } --- 2536,2551 ---- if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) { int col = mouse_col - curwin->w_wincol - (curwin->w_p_nu ? 9 : 1); + long off = pos2off(curbuf, &curwin->w_cursor); + + /* sync the cursor position */ + sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, cmdno, off, off); + nbdebug(("EVT: %s", buf)); + nb_send(buf, "netbeans_button_release[newDotAndMark]"); ! sprintf(buf, "%d:buttonRelease=%d %d %ld %d\n", bufno, cmdno, ! button, (long)curwin->w_cursor.lnum, col); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_button_release"); } *** ../vim-6.2.198/src/normal.c Sun Jan 18 21:31:56 2004 --- src/normal.c Thu Jan 22 16:50:57 2004 *************** *** 6134,6139 **** --- 6134,6148 ---- || cap->nchar == ']')) showmatch(); ++curwin->w_cursor.col; + #ifdef FEAT_NETBEANS_INTG + if (usingNetbeans) + { + colnr_T start = (colnr_T)(curwin->w_cursor.col + - cap->count1); + netbeans_inserted(curbuf, curwin->w_cursor.lnum, start, + (int)cap->count1, &ptr[start], (int)cap->count1); + } + #endif } /* mark the buffer as changed and prepare for displaying */ *** ../vim-6.2.198/src/version.c Sun Jan 25 19:35:19 2004 --- src/version.c Sun Jan 25 19:37:44 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 199, /**/ -- FROG: How you English say: I one more time, mac, I unclog my nose towards you, sons of a window-dresser, so, you think you could out-clever us French fellows with your silly knees-bent creeping about advancing behaviour. (blows a raspberry) I wave my private parts at your aunties, you brightly-coloured, mealy-templed, cranberry-smelling, electric donkey-bottom biters. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///