--- Bram Moolenaar <[EMAIL PROTECTED]> wrote: > Xavier de Gaye wrote: > > > During the "compile-debug-edit" development cycle, the signs placed in > > the Vim buffers by the IDE with the netbeans protocol can have their > > line numbers changed when the buffers are edited (a Vim sign sticks with > > the line it has been set upon, and moves with it). > > > > It would be nice to allow the IDE to query Vim for these updated line > > numbers, so that when the IDE restarts gdb after a new make and the IDE > > is capable of restoring the breakpoints set on a previous session, the > > breakpoints and their corresponding signs can be automatically set by > > the IDE to their new position. > > > > The netbeans function documentation can be: > > > > ======================================================================= > > 10.4 Functions and Replies *nb-functions* > > > > getAnno serNum Return the line number of the annotation in the buffer > > Arguments: > > serNum serial number of this placed annotation > > The reply is: > > lnum = line number of the annotation > > ======================================================================= > > > > > > The implementation can be based on the existing sign_list_placed() > > function in buffer.c. I can propose a patch if this request for change > > is acceptable. > > It makes sense. The only alternative is to listen to "insert" and > "delete" messages to keep track of the position, which probably requires > keeping a copy of the text.
Problem: Retrieving from Vim the signs positions set by the IDE after they have been moved in the buffer. Solution: Add the netbeans getAnno function for getting the new signs positions after a file has been edited. Files: src/netbeans.c The following patch uses the E652 and E653 error codes that are documented in netbeans.tx, but not used yet. The patch has been tested with clewn in debug mode. Index: runtime/doc/netbeans.txt =================================================================== *** runtime/doc/netbeans.txt (revision 179) --- runtime/doc/netbeans.txt (working copy) *************** *** 1,4 **** ! *netbeans.txt* For Vim version 7.0. Last change: 2006 Mar 09 VIM REFERENCE MANUAL by Gordon Prieur --- 1,4 ---- ! *netbeans.txt* For Vim version 7.0. Last change: 2006 Nov 08 VIM REFERENCE MANUAL by Gordon Prieur *************** *** 605,610 **** --- 605,619 ---- getMark Not implemented. + getAnno serNum + Return the line number of the annotation in the buffer. + Argument: + serNum serial number of this placed annotation + The reply may be: + 123 lnum line number of the annotation + 123 invalid annotation serial number + New in version 2.3. + getModified When a buffer is specified: Return zero if the buffer does not have changes, one if it does have changes. When no buffer is specified (buffer number zero): Return the Index: src/netbeans.c =================================================================== *** src/netbeans.c (revision 179) --- src/netbeans.c (working copy) *************** *** 1271,1276 **** --- 1271,1312 ---- nb_reply_text(cmdno, text); /* =====================================================================*/ } + else if (streq((char *)cmd, "getAnno")) + { + int nilreply = 1; + #ifdef FEAT_SIGNS + int serNum; + long linenum; + + if (buf == NULL || buf->bufp == NULL) + { + nbdebug((" null bufp in getAnno")); + EMSG("E652: null bufp in getAnno"); + retval = FAIL; + } + else + { + cp = (char *)args; + serNum = strtol(cp, &cp, 10); + + linenum = (long)buf_findsign(buf->bufp, serNum); + if (linenum != 0) + { + nb_reply_nr(cmdno, linenum); + nilreply = 0; + } + else + { + nbdebug((" invalid annotation number in getAnno")); + EMSG("E653: invalid annotation number in getAnno"); + retval = FAIL; + } + } + #endif + if (nilreply) + nb_reply_nil(cmdno); + /* =====================================================================*/ + } else if (streq((char *)cmd, "getLength")) { long len = 0; -- http://clewn.sourceforge.net gdb support in Vim