|
Karsten Hopp |
f777d5 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
f777d5 |
Subject: patch 7.1.107
|
|
Karsten Hopp |
f777d5 |
Fcc: outbox
|
|
Karsten Hopp |
f777d5 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
f777d5 |
Mime-Version: 1.0
|
|
Karsten Hopp |
f777d5 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
f777d5 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
f777d5 |
------------
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
Patch 7.1.107
|
|
Karsten Hopp |
f777d5 |
Problem: When doing a block selection and using "s" to change the text,
|
|
Karsten Hopp |
f777d5 |
while triggering auto-indenting, causes the wrong text to be
|
|
Karsten Hopp |
f777d5 |
repeated in other lines. (Adri Verhoef)
|
|
Karsten Hopp |
f777d5 |
Solution: Compute the change of indent and compensate for that.
|
|
Karsten Hopp |
f777d5 |
Files: src/ops.c
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
*** ../vim-7.1.106/src/ops.c Thu Jun 28 22:14:28 2007
|
|
Karsten Hopp |
f777d5 |
--- src/ops.c Thu Aug 30 11:41:10 2007
|
|
Karsten Hopp |
f777d5 |
***************
|
|
Karsten Hopp |
f777d5 |
*** 2477,2483 ****
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
/*
|
|
Karsten Hopp |
f777d5 |
* Spaces and tabs in the indent may have changed to other spaces and
|
|
Karsten Hopp |
f777d5 |
! * tabs. Get the starting column again and correct the lenght.
|
|
Karsten Hopp |
f777d5 |
* Don't do this when "$" used, end-of-line will have changed.
|
|
Karsten Hopp |
f777d5 |
*/
|
|
Karsten Hopp |
f777d5 |
block_prep(oap, &bd2, oap->start.lnum, TRUE);
|
|
Karsten Hopp |
f777d5 |
--- 2477,2483 ----
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
/*
|
|
Karsten Hopp |
f777d5 |
* Spaces and tabs in the indent may have changed to other spaces and
|
|
Karsten Hopp |
f777d5 |
! * tabs. Get the starting column again and correct the length.
|
|
Karsten Hopp |
f777d5 |
* Don't do this when "$" used, end-of-line will have changed.
|
|
Karsten Hopp |
f777d5 |
*/
|
|
Karsten Hopp |
f777d5 |
block_prep(oap, &bd2, oap->start.lnum, TRUE);
|
|
Karsten Hopp |
f777d5 |
***************
|
|
Karsten Hopp |
f777d5 |
*** 2534,2540 ****
|
|
Karsten Hopp |
f777d5 |
#ifdef FEAT_VISUALEXTRA
|
|
Karsten Hopp |
f777d5 |
long offset;
|
|
Karsten Hopp |
f777d5 |
linenr_T linenr;
|
|
Karsten Hopp |
f777d5 |
! long ins_len, pre_textlen = 0;
|
|
Karsten Hopp |
f777d5 |
char_u *firstline;
|
|
Karsten Hopp |
f777d5 |
char_u *ins_text, *newp, *oldp;
|
|
Karsten Hopp |
f777d5 |
struct block_def bd;
|
|
Karsten Hopp |
f777d5 |
--- 2534,2542 ----
|
|
Karsten Hopp |
f777d5 |
#ifdef FEAT_VISUALEXTRA
|
|
Karsten Hopp |
f777d5 |
long offset;
|
|
Karsten Hopp |
f777d5 |
linenr_T linenr;
|
|
Karsten Hopp |
f777d5 |
! long ins_len;
|
|
Karsten Hopp |
f777d5 |
! long pre_textlen = 0;
|
|
Karsten Hopp |
f777d5 |
! long pre_indent = 0;
|
|
Karsten Hopp |
f777d5 |
char_u *firstline;
|
|
Karsten Hopp |
f777d5 |
char_u *ins_text, *newp, *oldp;
|
|
Karsten Hopp |
f777d5 |
struct block_def bd;
|
|
Karsten Hopp |
f777d5 |
***************
|
|
Karsten Hopp |
f777d5 |
*** 2579,2585 ****
|
|
Karsten Hopp |
f777d5 |
|| gchar_cursor() == NUL))
|
|
Karsten Hopp |
f777d5 |
coladvance_force(getviscol());
|
|
Karsten Hopp |
f777d5 |
# endif
|
|
Karsten Hopp |
f777d5 |
! pre_textlen = (long)STRLEN(ml_get(oap->start.lnum));
|
|
Karsten Hopp |
f777d5 |
bd.textcol = curwin->w_cursor.col;
|
|
Karsten Hopp |
f777d5 |
}
|
|
Karsten Hopp |
f777d5 |
#endif
|
|
Karsten Hopp |
f777d5 |
--- 2581,2589 ----
|
|
Karsten Hopp |
f777d5 |
|| gchar_cursor() == NUL))
|
|
Karsten Hopp |
f777d5 |
coladvance_force(getviscol());
|
|
Karsten Hopp |
f777d5 |
# endif
|
|
Karsten Hopp |
f777d5 |
! firstline = ml_get(oap->start.lnum);
|
|
Karsten Hopp |
f777d5 |
! pre_textlen = (long)STRLEN(firstline);
|
|
Karsten Hopp |
f777d5 |
! pre_indent = (long)(skipwhite(firstline) - firstline);
|
|
Karsten Hopp |
f777d5 |
bd.textcol = curwin->w_cursor.col;
|
|
Karsten Hopp |
f777d5 |
}
|
|
Karsten Hopp |
f777d5 |
#endif
|
|
Karsten Hopp |
f777d5 |
***************
|
|
Karsten Hopp |
f777d5 |
*** 2598,2610 ****
|
|
Karsten Hopp |
f777d5 |
*/
|
|
Karsten Hopp |
f777d5 |
if (oap->block_mode && oap->start.lnum != oap->end.lnum)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
firstline = ml_get(oap->start.lnum);
|
|
Karsten Hopp |
f777d5 |
! /*
|
|
Karsten Hopp |
f777d5 |
! * Subsequent calls to ml_get() flush the firstline data - take a
|
|
Karsten Hopp |
f777d5 |
! * copy of the required bit.
|
|
Karsten Hopp |
f777d5 |
! */
|
|
Karsten Hopp |
f777d5 |
! if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
|
|
Karsten Hopp |
f777d5 |
--- 2602,2623 ----
|
|
Karsten Hopp |
f777d5 |
*/
|
|
Karsten Hopp |
f777d5 |
if (oap->block_mode && oap->start.lnum != oap->end.lnum)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
+ /* Auto-indenting may have changed the indent. If the cursor was past
|
|
Karsten Hopp |
f777d5 |
+ * the indent, exclude that indent change from the inserted text. */
|
|
Karsten Hopp |
f777d5 |
firstline = ml_get(oap->start.lnum);
|
|
Karsten Hopp |
f777d5 |
! if (bd.textcol > pre_indent)
|
|
Karsten Hopp |
f777d5 |
! {
|
|
Karsten Hopp |
f777d5 |
! long new_indent = (long)(skipwhite(firstline) - firstline);
|
|
Karsten Hopp |
f777d5 |
!
|
|
Karsten Hopp |
f777d5 |
! pre_textlen += new_indent - pre_indent;
|
|
Karsten Hopp |
f777d5 |
! bd.textcol += new_indent - pre_indent;
|
|
Karsten Hopp |
f777d5 |
! }
|
|
Karsten Hopp |
f777d5 |
!
|
|
Karsten Hopp |
f777d5 |
! ins_len = (long)STRLEN(firstline) - pre_textlen;
|
|
Karsten Hopp |
f777d5 |
! if (ins_len > 0)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
+ /* Subsequent calls to ml_get() flush the firstline data - take a
|
|
Karsten Hopp |
f777d5 |
+ * copy of the inserted text. */
|
|
Karsten Hopp |
f777d5 |
if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL)
|
|
Karsten Hopp |
f777d5 |
{
|
|
Karsten Hopp |
f777d5 |
vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len);
|
|
Karsten Hopp |
f777d5 |
*** ../vim-7.1.106/src/version.c Thu Sep 13 22:04:30 2007
|
|
Karsten Hopp |
f777d5 |
--- src/version.c Thu Sep 13 22:38:28 2007
|
|
Karsten Hopp |
f777d5 |
***************
|
|
Karsten Hopp |
f777d5 |
*** 668,669 ****
|
|
Karsten Hopp |
f777d5 |
--- 668,671 ----
|
|
Karsten Hopp |
f777d5 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
f777d5 |
+ /**/
|
|
Karsten Hopp |
f777d5 |
+ 107,
|
|
Karsten Hopp |
f777d5 |
/**/
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
--
|
|
Karsten Hopp |
f777d5 |
Windows
|
|
Karsten Hopp |
f777d5 |
M!uqoms
|
|
Karsten Hopp |
f777d5 |
|
|
Karsten Hopp |
f777d5 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
f777d5 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
f777d5 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
f777d5 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|