To:
[email protected]
Subject: Patch 6.3b.024
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 6.3b.024
Problem: "2daw" does not delete leading white space like "daw" does. (Jens
Paulus)
Solution: Include the white space when a count is used.
Files: src/search.c
*** ../vim-6.3b.023/src/search.c Wed Jun 2 11:15:11 2004
--- src/search.c Wed Jun 2 11:08:23 2004
***************
*** 2930,2935 ****
--- 2930,2936 ----
pos_T start_pos;
pos_T pos;
int inclusive = TRUE;
+ int include_white = FALSE;
cls_bigword = bigword;
***************
*** 2977,3002 ****
oneleft();
if (include)
! {
! /*
! * If we don't include white space at the end, move the start
! * to include some white space there. This makes "daw" work
! * better on the last word in a sentence. Don't delete white
! * space at start of line (indent).
! */
! if (cls() != 0)
! {
! pos = curwin->w_cursor; /* save cursor position */
! curwin->w_cursor = start_pos;
! if (oneleft() == OK)
! {
! back_in_line();
! if (cls() == 0 && curwin->w_cursor.col > 0)
! start_pos = curwin->w_cursor;
! }
! curwin->w_cursor = pos; /* put cursor back at end */
! }
! }
}
#ifdef FEAT_VISUAL
--- 2978,2984 ----
oneleft();
if (include)
! include_white = TRUE;
}
#ifdef FEAT_VISUAL
***************
*** 3068,3073 ****
--- 3050,3082 ----
}
--count;
}
+
+ if (include_white && cls() != 0)
+ {
+ /*
+ * If we don't include white space at the end, move the start
+ * to include some white space there. This makes "daw" work
+ * better on the last word in a sentence (and "2daw" on last-but-one
+ * word). But don't delete white space at start of line (indent).
+ */
+ pos = curwin->w_cursor; /* save cursor position */
+ curwin->w_cursor = start_pos;
+ if (oneleft() == OK)
+ {
+ back_in_line();
+ if (cls() == 0 && curwin->w_cursor.col > 0)
+ {
+ #ifdef FEAT_VISUAL
+ if (VIsual_active)
+ VIsual = curwin->w_cursor;
+ else
+ #endif
+ oap->start = curwin->w_cursor;
+ }
+ }
+ curwin->w_cursor = pos; /* put cursor back at end */
+ }
+
#ifdef FEAT_VISUAL
if (VIsual_active)
{
*** ../vim-6.3b.023/src/version.c Wed Jun 2 11:15:11 2004
--- src/version.c Wed Jun 2 11:16:19 2004
***************
*** 643,644 ****
--- 643,646 ----
{ /* Add new patch number below this line */
+ /**/
+ 24,
/**/
--
How To Keep A Healthy Level Of Insanity:
15. Five days in advance, tell your friends you can't attend their
party because you're not in the mood.
/// Bram Moolenaar --
[email protected] --
http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P --
http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims --
http://ICCF.nl/click1.html ///