vim-patch:7.4.655

Problem:    Text deleted by "dit" depends on indent of closing tag.
            (Jan Parthey)
Solution:   Do not adjust oap->end in do_pending_operator(). (Christian
            Brabandt)

b6c2735c56
This commit is contained in:
Johan Klokkhammer Helsing
2015-11-22 02:29:14 +01:00
parent 1fbb56795d
commit cfa2107e33
5 changed files with 27 additions and 6 deletions

View File

@@ -7474,6 +7474,13 @@ static void nv_object(cmdarg_T *cap)
flag = current_block(cap->oap, cap->count1, include, '<', '>'); flag = current_block(cap->oap, cap->count1, include, '<', '>');
break; break;
case 't': /* "at" = a tag block (xml and html) */ case 't': /* "at" = a tag block (xml and html) */
// Do not adjust oap->end in do_pending_operator()
// otherwise there are different results for 'dit'
// (note leading whitespace in last line):
// 1) <b> 2) <b>
// foobar foobar
// </b> </b>
cap->retval |= CA_NO_ADJ_OP_END;
flag = current_tagblock(cap->oap, cap->count1, include); flag = current_tagblock(cap->oap, cap->count1, include);
break; break;
case 'p': /* "ap" = a paragraph */ case 'p': /* "ap" = a paragraph */

View File

@@ -926,7 +926,7 @@ static int first_submatch(regmmatch_T *rp)
* Careful: If spats[0].off.line == TRUE and spats[0].off.off == 0 this * Careful: If spats[0].off.line == TRUE and spats[0].off.off == 0 this
* makes the movement linewise without moving the match position. * makes the movement linewise without moving the match position.
* *
* return 0 for failure, 1 for found, 2 for found and line offset added * Return 0 for failure, 1 for found, 2 for found and line offset added.
*/ */
int do_search( int do_search(
oparg_T *oap, /* can be NULL */ oparg_T *oap, /* can be NULL */
@@ -3201,6 +3201,7 @@ current_tagblock (
int do_include = include; int do_include = include;
bool save_p_ws = p_ws; bool save_p_ws = p_ws;
int retval = FAIL; int retval = FAIL;
int is_inclusive = true;
p_ws = false; p_ws = false;
@@ -3295,9 +3296,16 @@ again:
if (inc_cursor() < 0) if (inc_cursor() < 0)
break; break;
} else { } else {
/* Exclude the '<' of the end tag. */ char_u *c = get_cursor_pos_ptr();
if (*get_cursor_pos_ptr() == '<') // Exclude the '<' of the end tag.
// If the closing tag is on new line, do not decrement cursor, but make
// operation exclusive, so that the linefeed will be selected
if (*c == '<' && !VIsual_active && curwin->w_cursor.col == 0) {
// do not decrement cursor
is_inclusive = false;
} else if (*c == '<') {
dec_cursor(); dec_cursor();
}
} }
end_pos = curwin->w_cursor; end_pos = curwin->w_cursor;
@@ -3342,8 +3350,9 @@ again:
* on an empty area. */ * on an empty area. */
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
oap->inclusive = false; oap->inclusive = false;
} else } else {
oap->inclusive = true; oap->inclusive = is_inclusive;
}
} }
retval = OK; retval = OK;

View File

@@ -23,6 +23,7 @@ jfXdit
0fXdit 0fXdit
fXdat fXdat
0fXdat 0fXdat
dit
:" :"
:put =matchstr(\"abcd\", \".\", 0, 2) " b :put =matchstr(\"abcd\", \".\", 0, 2) " b
:put =matchstr(\"abcd\", \"..\", 0, 2) " bc :put =matchstr(\"abcd\", \"..\", 0, 2) " bc
@@ -97,6 +98,9 @@ voo "nah" sdf " asdf" sdf " sdf" sd
-<b>asdX<i>a<i />sdf</i>asdf</b>- -<b>asdX<i>a<i />sdf</i>asdf</b>-
-<b>asdf<i>Xasdf</i>asdf</b>- -<b>asdf<i>Xasdf</i>asdf</b>-
-<b>asdX<i>as<b />df</i>asdf</b>- -<b>asdX<i>as<b />df</i>asdf</b>-
-<b>
innertext object
</b>
</begin> </begin>
SEARCH: SEARCH:
foobar foobar

View File

@@ -11,6 +11,7 @@ voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd
-<b></b>- -<b></b>-
-<b>asdfasdf</b>- -<b>asdfasdf</b>-
-- --
-<b></b>
</begin> </begin>
b b
bc bc

View File

@@ -341,7 +341,7 @@ static int included_patches[] = {
// 658, // 658,
// 657 NA // 657 NA
// 656, // 656,
// 655, 655,
// 654, // 654,
653, 653,
// 652 NA // 652 NA