To: vim-dev@vim.org
Subject: patch 7.0.225
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.0.225
Problem: When using setline() in an InsertEnter autocommand and doing "A"
the cursor ends up on the last byte in the line. (Yukihiro
Nakadaira)
Solution: Only adjust the column when using setline() for the cursor line.
Move it back to the head byte if necessary.
Files: src/eval.c, src/misc2.c
*** ../vim-7.0.224/src/eval.c Tue Mar 27 16:57:54 2007
--- src/eval.c Thu Apr 26 10:52:09 2007
***************
*** 14397,14403 ****
if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
{
changed_bytes(lnum, 0);
! check_cursor_col();
rettv->vval.v_number = 0; /* OK */
}
}
--- 14411,14418 ----
if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
{
changed_bytes(lnum, 0);
! if (lnum == curwin->w_cursor.lnum)
! check_cursor_col();
rettv->vval.v_number = 0; /* OK */
}
}
*** ../vim-7.0.224/src/misc2.c Tue Feb 20 03:18:20 2007
--- src/misc2.c Tue Mar 27 21:59:56 2007
***************
*** 516,522 ****
--- 516,529 ----
|| virtual_active())
curwin->w_cursor.col = len;
else
+ {
curwin->w_cursor.col = len - 1;
+ #ifdef FEAT_MBYTE
+ /* prevent cursor from moving on the trail byte */
+ if (has_mbyte)
+ mb_adjust_cursor();
+ #endif
+ }
}
#ifdef FEAT_VIRTUALEDIT
*** ../vim-7.0.224/src/version.c Tue Mar 27 16:57:54 2007
--- src/version.c Thu Apr 26 10:53:33 2007
***************
*** 668,669 ****
--- 668,671 ----
{ /* Add new patch number below this line */
+ /**/
+ 225,
/**/
--
hundred-and-one symptoms of being an internet addict:
14. You start introducing yourself as "Jim at I-I-Net dot net dot au"
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///