Discrepancy between inner text objects for empty delimited blocks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Discrepancy between inner text objects for empty delimited blocks

Georgi Kirilov
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.)

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discrepancy between inner text objects for empty delimited blocks

Tony Mechelynck
On Thu, Jul 5, 2018 at 9:38 AM, Georgi Kirilov
<[hidden email]> 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Discrepancy between inner text objects for empty delimited blocks

Georgi Kirilov
On Thu, 5 Jul 2018 11:25:37 +0200
Tony Mechelynck <[hidden email]> wrote:

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

Nice catch! So there are not just two, but three different behaviors:

           | i(            | it
-----------+---------------+--------------
op-pending | no-op         | at
visual     | the parent i( | at

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

attachment0 (849 bytes) Download Attachment