|
Karsten Hopp |
37c7ad |
To: vim-dev@vim.org
|
|
Karsten Hopp |
37c7ad |
Subject: Patch 7.1.220
|
|
Karsten Hopp |
37c7ad |
Fcc: outbox
|
|
Karsten Hopp |
37c7ad |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
37c7ad |
Mime-Version: 1.0
|
|
Karsten Hopp |
37c7ad |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
37c7ad |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
37c7ad |
------------
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
Patch 7.1.220
|
|
Karsten Hopp |
37c7ad |
Problem: When a ")" or word movement command moves the cursor back from the
|
|
Karsten Hopp |
37c7ad |
end of the line it may end up on the trail byte of a multi-byte
|
|
Karsten Hopp |
37c7ad |
character. It's also moved back when it isn't needed.
|
|
Karsten Hopp |
37c7ad |
Solution: Add the adjust_cursor() function.
|
|
Karsten Hopp |
37c7ad |
Files: src/normal.c
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
*** ../vim-7.1.219/src/normal.c Sun Jan 6 20:05:36 2008
|
|
Karsten Hopp |
37c7ad |
--- src/normal.c Sat Jan 12 17:10:14 2008
|
|
Karsten Hopp |
37c7ad |
***************
|
|
Karsten Hopp |
37c7ad |
*** 150,155 ****
|
|
Karsten Hopp |
37c7ad |
--- 150,156 ----
|
|
Karsten Hopp |
37c7ad |
static void nv_bck_word __ARGS((cmdarg_T *cap));
|
|
Karsten Hopp |
37c7ad |
static void nv_wordcmd __ARGS((cmdarg_T *cap));
|
|
Karsten Hopp |
37c7ad |
static void nv_beginline __ARGS((cmdarg_T *cap));
|
|
Karsten Hopp |
37c7ad |
+ static void adjust_cursor __ARGS((oparg_T *oap));
|
|
Karsten Hopp |
37c7ad |
#ifdef FEAT_VISUAL
|
|
Karsten Hopp |
37c7ad |
static void adjust_for_sel __ARGS((cmdarg_T *cap));
|
|
Karsten Hopp |
37c7ad |
static int unadjust_for_sel __ARGS((void));
|
|
Karsten Hopp |
37c7ad |
***************
|
|
Karsten Hopp |
37c7ad |
*** 6567,6578 ****
|
|
Karsten Hopp |
37c7ad |
clearopbeep(cap->oap);
|
|
Karsten Hopp |
37c7ad |
else
|
|
Karsten Hopp |
37c7ad |
{
|
|
Karsten Hopp |
37c7ad |
! /* Don't leave the cursor on the NUL past a line */
|
|
Karsten Hopp |
37c7ad |
! if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL)
|
|
Karsten Hopp |
37c7ad |
! {
|
|
Karsten Hopp |
37c7ad |
! --curwin->w_cursor.col;
|
|
Karsten Hopp |
37c7ad |
! cap->oap->inclusive = TRUE;
|
|
Karsten Hopp |
37c7ad |
! }
|
|
Karsten Hopp |
37c7ad |
#ifdef FEAT_VIRTUALEDIT
|
|
Karsten Hopp |
37c7ad |
curwin->w_cursor.coladd = 0;
|
|
Karsten Hopp |
37c7ad |
#endif
|
|
Karsten Hopp |
37c7ad |
--- 6568,6575 ----
|
|
Karsten Hopp |
37c7ad |
clearopbeep(cap->oap);
|
|
Karsten Hopp |
37c7ad |
else
|
|
Karsten Hopp |
37c7ad |
{
|
|
Karsten Hopp |
37c7ad |
! /* Don't leave the cursor on the NUL past end of line. */
|
|
Karsten Hopp |
37c7ad |
! adjust_cursor(cap->oap);
|
|
Karsten Hopp |
37c7ad |
#ifdef FEAT_VIRTUALEDIT
|
|
Karsten Hopp |
37c7ad |
curwin->w_cursor.coladd = 0;
|
|
Karsten Hopp |
37c7ad |
#endif
|
|
Karsten Hopp |
37c7ad |
***************
|
|
Karsten Hopp |
37c7ad |
*** 8408,8419 ****
|
|
Karsten Hopp |
37c7ad |
else
|
|
Karsten Hopp |
37c7ad |
n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP);
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
! /* Don't leave the cursor on the NUL past a line */
|
|
Karsten Hopp |
37c7ad |
! if (n != FAIL && curwin->w_cursor.col > 0 && gchar_cursor() == NUL)
|
|
Karsten Hopp |
37c7ad |
! {
|
|
Karsten Hopp |
37c7ad |
! --curwin->w_cursor.col;
|
|
Karsten Hopp |
37c7ad |
! cap->oap->inclusive = TRUE;
|
|
Karsten Hopp |
37c7ad |
! }
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
if (n == FAIL && cap->oap->op_type == OP_NOP)
|
|
Karsten Hopp |
37c7ad |
clearopbeep(cap->oap);
|
|
Karsten Hopp |
37c7ad |
--- 8405,8413 ----
|
|
Karsten Hopp |
37c7ad |
else
|
|
Karsten Hopp |
37c7ad |
n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP);
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
! /* Don't leave the cursor on the NUL past the end of line. */
|
|
Karsten Hopp |
37c7ad |
! if (n != FAIL)
|
|
Karsten Hopp |
37c7ad |
! adjust_cursor(cap->oap);
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
if (n == FAIL && cap->oap->op_type == OP_NOP)
|
|
Karsten Hopp |
37c7ad |
clearopbeep(cap->oap);
|
|
Karsten Hopp |
37c7ad |
***************
|
|
Karsten Hopp |
37c7ad |
*** 8426,8431 ****
|
|
Karsten Hopp |
37c7ad |
--- 8420,8458 ----
|
|
Karsten Hopp |
37c7ad |
if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)
|
|
Karsten Hopp |
37c7ad |
foldOpenCursor();
|
|
Karsten Hopp |
37c7ad |
#endif
|
|
Karsten Hopp |
37c7ad |
+ }
|
|
Karsten Hopp |
37c7ad |
+ }
|
|
Karsten Hopp |
37c7ad |
+
|
|
Karsten Hopp |
37c7ad |
+ /*
|
|
Karsten Hopp |
37c7ad |
+ * Used after a movement command: If the cursor ends up on the NUL after the
|
|
Karsten Hopp |
37c7ad |
+ * end of the line, may move it back to the last character and make the motion
|
|
Karsten Hopp |
37c7ad |
+ * inclusive.
|
|
Karsten Hopp |
37c7ad |
+ */
|
|
Karsten Hopp |
37c7ad |
+ static void
|
|
Karsten Hopp |
37c7ad |
+ adjust_cursor(oap)
|
|
Karsten Hopp |
37c7ad |
+ oparg_T *oap;
|
|
Karsten Hopp |
37c7ad |
+ {
|
|
Karsten Hopp |
37c7ad |
+ /* The cursor cannot remain on the NUL when:
|
|
Karsten Hopp |
37c7ad |
+ * - the column is > 0
|
|
Karsten Hopp |
37c7ad |
+ * - not in Visual mode or 'selection' is "o"
|
|
Karsten Hopp |
37c7ad |
+ * - 'virtualedit' is not "all" and not "onemore".
|
|
Karsten Hopp |
37c7ad |
+ */
|
|
Karsten Hopp |
37c7ad |
+ if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL
|
|
Karsten Hopp |
37c7ad |
+ #ifdef FEAT_VISUAL
|
|
Karsten Hopp |
37c7ad |
+ && (!VIsual_active || *p_sel == 'o')
|
|
Karsten Hopp |
37c7ad |
+ #endif
|
|
Karsten Hopp |
37c7ad |
+ #ifdef FEAT_VIRTUALEDIT
|
|
Karsten Hopp |
37c7ad |
+ && !virtual_active() && (ve_flags & VE_ONEMORE) == 0
|
|
Karsten Hopp |
37c7ad |
+ #endif
|
|
Karsten Hopp |
37c7ad |
+ )
|
|
Karsten Hopp |
37c7ad |
+ {
|
|
Karsten Hopp |
37c7ad |
+ --curwin->w_cursor.col;
|
|
Karsten Hopp |
37c7ad |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
37c7ad |
+ /* prevent cursor from moving on the trail byte */
|
|
Karsten Hopp |
37c7ad |
+ if (has_mbyte)
|
|
Karsten Hopp |
37c7ad |
+ mb_adjust_cursor();
|
|
Karsten Hopp |
37c7ad |
+ #endif
|
|
Karsten Hopp |
37c7ad |
+ oap->inclusive = TRUE;
|
|
Karsten Hopp |
37c7ad |
}
|
|
Karsten Hopp |
37c7ad |
}
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
*** ../vim-7.1.219/src/version.c Sat Jan 12 16:45:25 2008
|
|
Karsten Hopp |
37c7ad |
--- src/version.c Sat Jan 12 17:07:28 2008
|
|
Karsten Hopp |
37c7ad |
***************
|
|
Karsten Hopp |
37c7ad |
*** 668,669 ****
|
|
Karsten Hopp |
37c7ad |
--- 668,671 ----
|
|
Karsten Hopp |
37c7ad |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
37c7ad |
+ /**/
|
|
Karsten Hopp |
37c7ad |
+ 220,
|
|
Karsten Hopp |
37c7ad |
/**/
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
--
|
|
Karsten Hopp |
37c7ad |
A hamburger walks into a bar, and the bartender says: "I'm sorry,
|
|
Karsten Hopp |
37c7ad |
but we don't serve food here."
|
|
Karsten Hopp |
37c7ad |
|
|
Karsten Hopp |
37c7ad |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
37c7ad |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
37c7ad |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
37c7ad |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|