To: vim-dev@vim.org Subject: Patch 6.2.528 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.528 Problem: NetBeans: Changes of the "~" command are not reported. Solution: Call netbeans_inserted() after performing "~". (Gordon Prieur) Also change NetBeans debugging to append to the log file. Also fix that "~" in Visual block mode changes too much if there are multi-byte characters. Files: src/nbdebug.c, src/normal.c, src/ops.c *** ../vim-6.2.527/src/nbdebug.c Sun Oct 12 16:42:14 2003 --- src/nbdebug.c Wed Apr 14 19:55:02 2004 *************** *** 86,92 **** if (log_var && (file = getenv(log_var)) != NULL) { time_t now; ! nb_debug = fopen(file, "w"); time(&now); fprintf(nb_debug, "%s", asctime(localtime(&now))); if (level_var && (cp = getenv(level_var)) != NULL) { --- 86,92 ---- if (log_var && (file = getenv(log_var)) != NULL) { time_t now; ! nb_debug = fopen(file, "a"); time(&now); fprintf(nb_debug, "%s", asctime(localtime(&now))); if (level_var && (cp = getenv(level_var)) != NULL) { *** ../vim-6.2.527/src/normal.c Mon Apr 19 20:26:43 2004 --- src/normal.c Mon Apr 26 15:19:26 2004 *************** *** 6460,6465 **** --- 6460,6470 ---- long n; pos_T startpos; int did_change = 0; + #ifdef FEAT_NETBEANS_INTG + pos_T pos; + char_u *ptr; + int count; + #endif if (checkclearopq(cap->oap)) return; *************** *** 6476,6481 **** --- 6481,6489 ---- return; startpos = curwin->w_cursor; + #ifdef FEAT_NETBEANS_INTG + pos = startpos; + #endif for (n = cap->count1; n > 0; --n) { did_change |= swapchar(cap->oap->op_type, &curwin->w_cursor); *************** *** 6485,6490 **** --- 6493,6512 ---- if (vim_strchr(p_ww, '~') != NULL && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { + #ifdef FEAT_NETBEANS_INTG + if (usingNetbeans) + { + if (did_change) + { + ptr = ml_get(pos.lnum); + count = STRLEN(ptr) - pos.col; + netbeans_inserted(curbuf, pos.lnum, pos.col, + count, &ptr[pos.col], count); + } + pos.col = 0; + pos.lnum++; + } + #endif ++curwin->w_cursor.lnum; curwin->w_cursor.col = 0; if (n > 1) *************** *** 6498,6503 **** --- 6520,6535 ---- break; } } + #ifdef FEAT_NETBEANS_INTG + if (did_change && usingNetbeans) + { + ptr = ml_get(pos.lnum); + count = curwin->w_cursor.col - pos.col; + netbeans_inserted(curbuf, pos.lnum, pos.col, + count, &ptr[pos.col], count); + } + #endif + check_cursor(); curwin->w_set_curswant = TRUE; *** ../vim-6.2.527/src/ops.c Fri Apr 30 19:42:02 2004 --- src/ops.c Wed May 5 10:34:02 2004 *************** *** 2148,2155 **** --- 2148,2159 ---- pos_T pos; #ifdef FEAT_VISUAL struct block_def bd; + int done; #endif int did_change = 0; + #ifdef FEAT_MBYTE + colnr_T col; + #endif if (u_save((linenr_T)(oap->start.lnum - 1), (linenr_T)(oap->end.lnum + 1)) == FAIL) *************** *** 2163,2174 **** { block_prep(oap, &bd, pos.lnum, FALSE); pos.col = bd.textcol; ! while (--bd.textlen >= 0) { did_change |= swapchar(oap->op_type, &pos); if (inc(&pos) == -1) /* at end of file */ break; } } if (did_change) changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); --- 2167,2195 ---- { block_prep(oap, &bd, pos.lnum, FALSE); pos.col = bd.textcol; ! for (done = 0; done < bd.textlen; ++done) { did_change |= swapchar(oap->op_type, &pos); + # ifdef FEAT_MBYTE + col = pos.col + 1; + # endif if (inc(&pos) == -1) /* at end of file */ break; + # ifdef FEAT_MBYTE + if (pos.col > col) + /* Count extra bytes of a multi-byte character. */ + done += pos.col - col; + # endif } + # ifdef FEAT_NETBEANS_INTG + if (usingNetbeans && did_change) + { + char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); + + netbeans_inserted(curbuf, pos.lnum, bd.textcol, + bd.textlen, &ptr[bd.textcol], bd.textlen); + } + # endif } if (did_change) changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); *************** *** 2194,2201 **** --- 2215,2246 ---- break; } if (did_change) + { changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L); + #ifdef FEAT_NETBEANS_INTG + if (usingNetbeans && did_change) + { + char_u *ptr; + int count; + + pos = oap->start; + while (pos.lnum < oap->end.lnum) + { + ptr = ml_get_buf(curbuf, pos.lnum, FALSE); + count = STRLEN(ptr) - pos.col; + netbeans_inserted(curbuf, pos.lnum, pos.col, + count, &ptr[pos.col], count); + pos.col = 0; + pos.lnum++; + } + ptr = ml_get_buf(curbuf, pos.lnum, FALSE); + count = oap->end.col - pos.col + 1; + netbeans_inserted(curbuf, pos.lnum, pos.col, + count, &ptr[pos.col], count); + } + #endif + } } #ifdef FEAT_VISUAL *** ../vim-6.2.527/src/version.c Wed May 5 11:17:53 2004 --- src/version.c Wed May 5 11:47:08 2004 *************** *** 639,640 **** --- 642,645 ---- { /* Add new patch number below this line */ + /**/ + 528, /**/ -- Nobody will ever need more than 640 kB RAM. -- Bill Gates, 1983 Windows 98 requires 16 MB RAM. -- Bill Gates, 1999 Logical conclusion: Nobody will ever need Windows 98. /// 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 /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///