Balance vs Balance Tags

44 views
Skip to first unread message

Simdude

unread,
Nov 14, 2019, 9:55:49 PM11/14/19
to BBEdit Talk
I'm having trouble seeing the difference between Balance and Balance tags. For example, with this code snippet:

   <ul>
        <li>Book 1</li>
        <li>Book 2</li>
        <li>Book 3</li>
    </ul>

If my cursor is on "Book 1" and I use either Balance or Balance tags, the result is the same. All of Book 1 is selected. If I hit either again, everything between the ul tags is selected. So, when do these two operations act differently?

Mark

Bruce Van Allen

unread,
Nov 14, 2019, 11:22:22 PM11/14/19
to bbe...@googlegroups.com
A difference is that "Balance" checks things other than html
tags - like parentheses & bracket pairing in text and code files.

Another aspect of "Balance" can give you different behavior:

From Expert Preferences:
By default, the "Balance" command (or double-clicking on a
delimiter to balance) does not include the delimiters in the
resulting selection. If you would like for it to do so:
defaults write com.barebones.bbedit BalanceIncludesDelimiters
-bool YES

HTH
--

- Bruce

_bruce__van_allen__santa_cruz__ca_

Simdude

unread,
Nov 15, 2019, 9:43:45 AM11/15/19
to BBEdit Talk
Thanks Bruce. I did notice after if I had something like:

   <ul>
        <li>This is my "Book 1"</li>
        <li>Book 2</li>
        <li>Book 3</li>
    </ul>

and the cursor was in "Book 1" that Balance will grab inside the quotes where the Balance Tags gets everything in the tags of course. I guess I was just seeing similar behavior because I was not in another enclosing pair of (), {} or whatever.

Simdude

unread,
Nov 15, 2019, 6:51:08 PM11/15/19
to BBEdit Talk
So, I wanted to reopen because something seems strange to me. Given the following snippet:

<head>
<title>Mark Miller</title>
<meta name="generator" content="BBEdit 13.0" />
<link rel="stylesheet" type="" href=“<#URI#>“ />
</head>

If I put my cursor in the <#URI#> and hit CMD-B, I expected to select everything in the double quotes. As I read through the manual, I realized it would only work with "smart" quotes. So I "educated" the quotes and tried again. CMD-B is still selecting everything in the head tag. I'm also not sure if it's even allowed to use smart quotes inside an html tag.
Reply all
Reply to author
Forward
0 new messages