To:
[email protected]
Subject: Patch 6.0ax.011
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
------------
Patch 6.0ax.011
Problem: When 'virtualedit' is set and 'selection' is "exclusive",
Visually selecting until the start of a following line didn't
include the line break. (Joseph Edward Miele)
Solution: Remember that the end of the selection was moved to the previous
line and include the line break then.
Files: src/normal.c
*** ../vim60ax.10/src/normal.c Wed Sep 19 20:09:54 2001
--- src/normal.c Fri Sep 21 22:37:08 2001
***************
*** 146,152 ****
static void nv_beginline __ARGS((cmdarg_T *cap));
#ifdef FEAT_VISUAL
static void adjust_for_sel __ARGS((cmdarg_T *cap));
! static void unadjust_for_sel __ARGS((void));
static void nv_select __ARGS((cmdarg_T *cap));
#endif
static void nv_goto __ARGS((cmdarg_T *cap));
--- 146,152 ----
static void nv_beginline __ARGS((cmdarg_T *cap));
#ifdef FEAT_VISUAL
static void adjust_for_sel __ARGS((cmdarg_T *cap));
! static int unadjust_for_sel __ARGS((void));
static void nv_select __ARGS((cmdarg_T *cap));
#endif
static void nv_goto __ARGS((cmdarg_T *cap));
***************
*** 1225,1230 ****
--- 1225,1233 ----
static linenr_T redo_VIsual_line_count; /* number of lines */
static colnr_T redo_VIsual_col; /* number of cols or end column */
static long redo_VIsual_count; /* count for Visual operator */
+ # ifdef FEAT_VIRTUALEDIT
+ int include_line_break = FALSE;
+ # endif
#endif
#if defined(FEAT_CLIPBOARD)
***************
*** 1366,1372 ****
/* If 'selection' is "exclusive", backup one character for
* charwise selections. */
else if (VIsual_mode == 'v')
! unadjust_for_sel();
oap->start = VIsual;
if (VIsual_mode == 'V')
--- 1369,1380 ----
/* If 'selection' is "exclusive", backup one character for
* charwise selections. */
else if (VIsual_mode == 'v')
! {
! # ifdef FEAT_VIRTUALEDIT
! include_line_break =
! # endif
! unadjust_for_sel();
! }
oap->start = VIsual;
if (VIsual_mode == 'V')
***************
*** 1528,1534 ****
{
oap->motion_type = MCHAR;
if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL
! && !virtual_active())
{
oap->inclusive = FALSE;
/* Try to include the newline, unless it's an operator
--- 1536,1545 ----
{
oap->motion_type = MCHAR;
if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL
! # ifdef FEAT_VIRTUALEDIT
! && (include_line_break || !virtual_active())
! # endif
! )
{
oap->inclusive = FALSE;
/* Try to include the newline, unless it's an operator
***************
*** 1539,1547 ****
{
++oap->end.lnum;
oap->end.col = 0;
! #ifdef FEAT_VIRTULEDIT
oap->end.coladd = 0;
! #endif
++oap->line_count;
}
}
--- 1550,1558 ----
{
++oap->end.lnum;
oap->end.col = 0;
! # ifdef FEAT_VIRTUALEDIT
oap->end.coladd = 0;
! # endif
++oap->line_count;
}
}
***************
*** 7361,7368 ****
/*
* Exclude last character at end of Visual area for 'selection' == "exclusive".
* Should check VIsual_mode before calling this.
*/
! static void
unadjust_for_sel()
{
pos_T *pp;
--- 7372,7380 ----
/*
* Exclude last character at end of Visual area for 'selection' == "exclusive".
* Should check VIsual_mode before calling this.
+ * Returns TRUE when backed up to the previous line.
*/
! static int
unadjust_for_sel()
{
pos_T *pp;
***************
*** 7379,7386 ****
--- 7391,7400 ----
{
--pp->lnum;
pp->col = (colnr_T)STRLEN(ml_get(pp->lnum));
+ return TRUE;
}
}
+ return FALSE;
}
/*
*** ../vim60ax.10/src/version.c Fri Sep 21 22:34:38 2001
--- src/version.c Fri Sep 21 22:30:10 2001
***************
*** 608,609 ****
--- 608,611 ----
{ /* Add new patch number below this line */
+ /**/
+ 11,
/**/
--
Beer & pretzels can't be served at the same time in any bar or restaurant.
[real standing law in North Dakota, United States of America]
/// Bram Moolenaar --
[email protected] --
http://www.moolenaar.net \\\
((( Creator of Vim --
http://vim.sf.net --
ftp://ftp.vim.org/pub/vim )))
\\\ Help me helping AIDS orphans in Uganda -
http://iccf-holland.org ///