Thursday, July 5, 2018

Re: Discrepancy between inner text objects for empty delimited blocks

On Thu, Jul 5, 2018 at 9:38 AM, Georgi Kirilov
<kirilov.georgi.s@gmail.com> wrote:
> Executing the inner object of an empty HTML element will select the outer object:
>
> <p> text <i>|</i> text </p>
> dit
> <p> text text </p>
>
> Doing the same with any other kind of delimited block, say, a parenthesized one, is just a no-op:
>
> (defun (|) arg)
> dib
> (defun (|) arg)
>
> Theoretically speaking, this looks like inconsistency.
> Is there some subtle practical value in it?
>
> (The behavior is documented in :help tag-blocks, but there's no explanation as to why it only applies to tag delimiters.)

The "HTML/XML/SGML element" block is special in that its begin and end
marker are more than one character, unlike i" i' i( i[ i{ i< . Also,
in HTML only (not in XML or even in XHTML) it is possible in some
cases to have an "unpaired tag" not ending in /> -- e.g. a <p> element
is implicitly closed by an opening <p> tag, or a <li> element by an
opening <li> tag which is not within <ol>..</ol> or <ul>..</ul> at the
next inner level. IIUC it on such an "implicitly closed" element would
select its parent which could be a <div> or even the <body>.

I notice that yit or dit on an empty element (with opening and closing
tags) yanks or deletes the whole (as if it had been yat or dat
respectively) while vit moves to the < of the closing tag (even if the
cursor was within the opening tag) and selects just that character.

On the inner ( of ( () ), vi( selects until, but not including,
the outer parentheses while di( is a no-op. Strange.


Best regards,
Tony.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: