diff options
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/search.c b/src/search.c index 3276a77b7..8beacbbc3 100644 --- a/src/search.c +++ b/src/search.c @@ -1063,7 +1063,7 @@ first_submatch(rp) * Careful: If spats[0].off.line == TRUE and spats[0].off.off == 0 this * 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(oap, dirc, pat, count, options, tm) @@ -3781,6 +3781,7 @@ current_tagblock(oap, count_arg, include) int do_include = include; int save_p_ws = p_ws; int retval = FAIL; + int is_inclusive = TRUE; p_ws = FALSE; @@ -3895,8 +3896,15 @@ again: } else { - /* Exclude the '<' of the end tag. */ - if (*ml_get_cursor() == '<') + char_u *c = ml_get_cursor(); + + /* 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(); } end_pos = curwin->w_cursor; @@ -3950,7 +3958,7 @@ again: oap->inclusive = FALSE; } else - oap->inclusive = TRUE; + oap->inclusive = is_inclusive; } retval = OK; |