On Mo, 09 Feb 2015, Christian Brabandt wrote:

> Hi Bram!
> 
> On Mo, 09 Feb 2015, Bram Moolenaar wrote:
> 
> > > Expected: Same result, regardless of indent.
> > > 
> > > How to reproduce - details
> > > ==========================
> > > 
> > > Case_A: closing tag w/o any indent
> > > 
> > >     1. contents:
> > >   |<li>
> > >   |foo
> > >   |</li>
> > >   ^ Note: pipe symbols mark window edge and are not part of contents
> > >     2. type "dit"
> > >     3. result: tags end up on different lines
> > >   |<li>
> > >   |</li>
> > > 
> > > Case_B: closing tag with some indent
> > > 
> > >     1. contents:
> > >   |<li>
> > >   |foo
> > >   |    </li>
> > >     2. type "dit"
> > >     3. result: tags end up on same line
> > >   |<li></li>
> > > 
> > > Additional Notes:
> > > =================
> > > - inconsistency goes away when using "vitd" instead of "dit"
> > > - compare "dit" with "di{" - latter behaves more nicely, IMHO
> > > - issue can be worked around with a custom mapping:
> > >   :onoremap it :normal! vit<CR>
> > > - unfortunately, this workaround doesn't fix "surround" plugin (ID 1697) 
> > > which
> > >   breaks for removing tags at end of buffer that have no indent
> > >   (problem: line preceding opening tag ends up after XML element contents)
> > 
> 
> Here is a patch including a test case.
> 
> > I'll put it on the todo list.
> 
> Will this ever going to shrink?

Opps, I just noticed, that a comment wasn't closed properly. So here is 
the patch again.

Best,
Christian
-- 
Und doch ist dem Menschen, der nicht stationär, sondern 
beweglich gedacht wird, hierin die sicherste Lehre durch Parallaxe 
verliehen.
                -- Goethe, Maximen und Reflektionen, Nr. 529

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -9175,6 +9175,13 @@ nv_object(cap)
 		flag = current_block(cap->oap, cap->count1, include, '<', '>');
 		break;
 	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)
+		 * 1) <b>      2) <b>
+		 *    foobar      foobar
+		 *    </b>            </b> */
+		cap->retval |= CA_NO_ADJ_OP_END;
 		flag = current_tagblock(cap->oap, cap->count1, include);
 		break;
 	case 'p': /* "ap" = a paragraph */
diff --git a/src/search.c b/src/search.c
--- a/src/search.c
+++ b/src/search.c
@@ -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;
 
@@ -3896,7 +3897,15 @@ again:
     else
     {
 	/* Exclude the '<' of the end tag. */
-	if (*ml_get_cursor() == '<')
+	char_u *c = ml_get_cursor();
+	/* Start visual mode, so that the complete line
+	 * will be removed
+	 * (otherwise, we are left with an empty line) */
+	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 +3959,7 @@ again:
 	    oap->inclusive = FALSE;
 	}
 	else
-	    oap->inclusive = TRUE;
+	    oap->inclusive = is_inclusive;
     }
     retval = OK;
 
diff --git a/src/testdir/test53.in b/src/testdir/test53.in
--- a/src/testdir/test53.in
+++ b/src/testdir/test53.in
@@ -23,6 +23,7 @@ jfXdit
 0fXdit
 fXdat
 0fXdat
+dit
 :"
 :put =matchstr(\"abcd\", \".\", 0, 2) " b
 :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>asdf<i>Xasdf</i>asdf</b>-
 -<b>asdX<i>as<b />df</i>asdf</b>-
+-<b>
+innertext object
+</b>
 </begin>
 SEARCH:
 foobar
diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok
--- a/src/testdir/test53.ok
+++ b/src/testdir/test53.ok
@@ -11,6 +11,7 @@ voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd
 -<b></b>-
 -<b>asdfasdf</b>-
 --
+-<b></b>
 </begin>
 b
 bc

Raspunde prin e-mail lui