home *** CD-ROM | disk | FTP | other *** search
- To: vim_dev@googlegroups.com
- Subject: Patch 7.4.064
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 7.4.064
- Problem: When replacing a character in Visual block mode, entering a CR
- does not cause a repeated line break.
- Solution: Recognize the situation and repeat the line break. (Christian
- Brabandt)
- Files: src/normal.c, src/ops.c, src/testdir/test39.in,
- src/testdir/test39.ok
-
-
- *** ../vim-7.4.063/src/normal.c 2013-09-25 18:54:20.000000000 +0200
- --- src/normal.c 2013-11-04 01:14:53.000000000 +0100
- ***************
- *** 7036,7041 ****
- --- 7036,7048 ----
- {
- if (got_int)
- reset_VIsual();
- + if (had_ctrl_v)
- + {
- + if (cap->nchar == '\r')
- + cap->nchar = -1;
- + else if (cap->nchar == '\n')
- + cap->nchar = -2;
- + }
- nv_operator(cap);
- return;
- }
- *** ../vim-7.4.063/src/ops.c 2013-11-02 23:59:30.000000000 +0100
- --- src/ops.c 2013-11-04 01:28:54.000000000 +0100
- ***************
- *** 2074,2083 ****
- --- 2074,2088 ----
- char_u *newp, *oldp;
- size_t oldlen;
- struct block_def bd;
- + char_u *after_p = NULL;
- + int had_ctrl_v_cr = (c == -1 || c == -2);
-
- if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty)
- return OK; /* nothing to do */
-
- + if (had_ctrl_v_cr)
- + c = (c == -1 ? '\r' : '\n');
- +
- #ifdef FEAT_MBYTE
- if (has_mbyte)
- mb_adjust_opend(oap);
- ***************
- *** 2164,2188 ****
- /* insert pre-spaces */
- copy_spaces(newp + bd.textcol, (size_t)bd.startspaces);
- /* insert replacement chars CHECK FOR ALLOCATED SPACE */
- ! #ifdef FEAT_MBYTE
- ! if (has_mbyte)
- {
- ! n = (int)STRLEN(newp);
- ! while (--num_chars >= 0)
- ! n += (*mb_char2bytes)(c, newp + n);
- }
- else
- - #endif
- - copy_chars(newp + STRLEN(newp), (size_t)numc, c);
- - if (!bd.is_short)
- {
- ! /* insert post-spaces */
- ! copy_spaces(newp + STRLEN(newp), (size_t)bd.endspaces);
- ! /* copy the part after the changed part */
- ! STRMOVE(newp + STRLEN(newp), oldp);
- }
- /* replace the line */
- ml_replace(curwin->w_cursor.lnum, newp, FALSE);
- }
- }
- else
- --- 2169,2211 ----
- /* insert pre-spaces */
- copy_spaces(newp + bd.textcol, (size_t)bd.startspaces);
- /* insert replacement chars CHECK FOR ALLOCATED SPACE */
- ! /* -1/-2 is used for entering CR literally. */
- ! if (had_ctrl_v_cr || (c != '\r' && c != '\n'))
- {
- ! #ifdef FEAT_MBYTE
- ! if (has_mbyte)
- ! {
- ! n = (int)STRLEN(newp);
- ! while (--num_chars >= 0)
- ! n += (*mb_char2bytes)(c, newp + n);
- ! }
- ! else
- ! #endif
- ! copy_chars(newp + STRLEN(newp), (size_t)numc, c);
- ! if (!bd.is_short)
- ! {
- ! /* insert post-spaces */
- ! copy_spaces(newp + STRLEN(newp), (size_t)bd.endspaces);
- ! /* copy the part after the changed part */
- ! STRMOVE(newp + STRLEN(newp), oldp);
- ! }
- }
- else
- {
- ! /* Replacing with \r or \n means splitting the line. */
- ! after_p = alloc_check((unsigned)oldlen + 1 + n - STRLEN(newp));
- ! if (after_p != NULL)
- ! STRMOVE(after_p, oldp);
- }
- /* replace the line */
- ml_replace(curwin->w_cursor.lnum, newp, FALSE);
- + if (after_p != NULL)
- + {
- + ml_append(curwin->w_cursor.lnum++, after_p, 0, FALSE);
- + appended_lines_mark(curwin->w_cursor.lnum, 1L);
- + oap->end.lnum++;
- + vim_free(after_p);
- + }
- }
- }
- else
- *** ../vim-7.4.063/src/testdir/test39.in 2013-03-07 18:30:38.000000000 +0100
- --- src/testdir/test39.in 2013-11-04 01:36:34.000000000 +0100
- ***************
- *** 32,37 ****
- --- 32,41 ----
- doh dutVkUj
- :" Uppercase part of two lines
- ddppi333k0i222fyllvjfuUk
- + :" visual replace using Enter or NL
- + G3o123456789k05l2jr
- G3o98765k02l2jr
- + G3o123456789k05l2jr
- + G3o98765k02l2jr
- :/^the/,$w >> test.out
- :qa!
- ENDTEST
- *** ../vim-7.4.063/src/testdir/test39.ok 2013-03-07 18:28:51.000000000 +0100
- --- src/testdir/test39.ok 2013-11-04 01:37:12.000000000 +0100
- ***************
- *** 11,13 ****
- --- 11,31 ----
- DOH DUT
- 222the yoUTUSSEUU END
- 333THE YOUTUâ–€euu end
- + 12345
- + 789
- + 12345
- + 789
- + 12345
- + 789
- + 98
- 65
- + 98
- 65
- + 98
- 65
- + 12345
- + 789
- + 12345
- + 789
- + 12345
- + 789
- + 98 65
- + 98 65
- + 98 65
- *** ../vim-7.4.063/src/version.c 2013-11-04 00:34:47.000000000 +0100
- --- src/version.c 2013-11-04 01:39:26.000000000 +0100
- ***************
- *** 740,741 ****
- --- 740,743 ----
- { /* Add new patch number below this line */
- + /**/
- + 64,
- /**/
-
- --
- So when I saw the post to comp.editors, I rushed over to the FTP site to
- grab it. So I yank apart the tarball, light x candles, where x= the
- vim version multiplied by the md5sum of the source divided by the MAC of
- my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights,
- wave a dead chicken over the hard drive, and summon the power of GNU GCC
- with the magic words "make config ; make!".
- [Jason Spence, compiling Vim 5.0]
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
- \\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
-