<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>src/Support/Scripts/balance.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -165,7 +165,7 @@ def entities_to_hex(text, wrap):
     return re.sub(r'&amp;(#x?)?([0-9]+|[0-9a-fA-F]+);', wrap_hex, text)
 
 def trim(context, text, lines=True, sides='both', respect_indent=False,
-		 preserve_linebreaks=True):
+         preserve_linebreaks=True):
     '''
     Trims whitespace from the text
     
@@ -353,7 +353,7 @@ def get_word(context, range, alpha_numeric=True, extra_characters='_-',
     '''
     # Helper regex for determining if line ends with a tag
     # Includes checks for ASP/PHP/JSP/ColdFusion closing delimiters
-    re_tag = re.compile(r'(&lt;\/?[\w:\-]+[^&gt;]*|\s*(\?|%|-{2,3}))&gt;$')
+    re_tag = re.compile(r'(&lt;\/?[\w:-]+[^&gt;]*|\s*(/|\?|%|-{2,3}))&gt;$')
     
     def test_word():
         # Mini-function to cut down on code bloat
@@ -482,6 +482,49 @@ def select_from_zones(context, range=None, default=None, **syntaxes):
     # If we reach this point, there's no match
     return default
 
+def range_in_zone(context, range, selector):
+    '''
+    Tests the location of the range to see if it matches the provided
+    zone selector string
+    '''
+    target = SXSelectorGroup.selectorGroupWithString_(selector)
+    if context.string().length() == range.location:
+        zone = context.syntaxTree().rootZone()
+    else:
+        zone = context.syntaxTree().rootZone().zoneAtCharacterIndex_(
+            range.location
+        )
+    return target.matches_(zone)
+
+def cursor_in_zone(context, selector):
+    '''
+    Tests the location of the range to see if it matches the provided
+    zone selector string
+    '''
+    ranges = get_ranges(context)
+    return range_in_zone(context, ranges[0], selector)
+
+# ===============================================================
+# Itemizer methods
+# ===============================================================
+
+def get_item_for_range(context, range):
+    '''Returns the smallest item containing the given range'''
+    return context.itemizer().smallestItemContainingCharacterRange_(range)
+
+def get_item_parent_for_range(context, range):
+    '''Returns the parent of the item containing the given range'''
+    item = get_item_for_range(context, range)
+    if item is None:
+        return None
+    new_range = item.range()
+    # Select the parent if the range is the same
+    while(item.parent() and (new_range.location == range.location and \
+          new_range.length == range.length)):
+        item = item.parent()
+        new_range = item.range()
+    return item
+
 # ===============================================================
 # Snippet methods
 # ===============================================================</diff>
      <filename>src/Support/Library/tea_actions.py</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,30 @@
 		&lt;/setup&gt;
 	&lt;/action&gt;
 	
+	&lt;action id=&quot;com.onecrayon.TextActions.Balance&quot; category=&quot;actions.text.generic/actions.text.selection/tea.balance&quot;&gt;
+		&lt;class&gt;TEAforEspresso&lt;/class&gt;
+		&lt;title&gt;Balance&lt;/title&gt;
+		&lt;key-equivalent&gt;control b&lt;/key-equivalent&gt;
+		&lt;setup&gt;
+			&lt;action&gt;balance&lt;/action&gt;
+		&lt;/setup&gt;
+	&lt;/action&gt;
+	
+	&lt;action id=&quot;com.onecrayon.TextActions.BalanceIn&quot; category=&quot;actions.text.generic/actions.text.selection/tea.balance&quot;&gt;
+		&lt;class&gt;TEAforEspresso&lt;/class&gt;
+		&lt;title&gt;Balance Inward&lt;/title&gt;
+		&lt;key-equivalent&gt;control B&lt;/key-equivalent&gt;
+		&lt;setup&gt;
+			&lt;action&gt;balance&lt;/action&gt;
+			&lt;options&gt;
+				&lt;dict&gt;
+					&lt;key&gt;direction&lt;/key&gt;
+					&lt;string&gt;in&lt;/string&gt;
+				&lt;/dict&gt;
+			&lt;/options&gt;
+		&lt;/setup&gt;
+	&lt;/action&gt;
+	
 	&lt;action id=&quot;com.onecrayon.TextActions.SelectWord&quot; category=&quot;actions.text.generic/actions.text.selection/1&quot;&gt;
 		&lt;class&gt;TEAforEspresso&lt;/class&gt;
 		&lt;title&gt;Word&lt;/title&gt;
@@ -209,6 +233,24 @@
 		&lt;/setup&gt;
 	&lt;/action&gt;
 	
+	&lt;action id=&quot;com.onecrayon.TextActions.InsertText.Tab&quot; category=&quot;actions.text.formatting/tea.insertion&quot;&gt;
+		&lt;class&gt;TEAforEspresso&lt;/class&gt;
+		&lt;title&gt;Insert Tab In Tab Stop&lt;/title&gt;
+		&lt;key-equivalent&gt;option tab&lt;/key-equivalent&gt;
+		&lt;setup&gt;
+			&lt;action&gt;insert_text&lt;/action&gt;
+			&lt;options&gt;
+				&lt;dict&gt;
+					&lt;key&gt;default&lt;/key&gt;
+					&lt;string&gt;	$TOUCH&lt;/string&gt;
+					
+					&lt;key&gt;undo_name&lt;/key&gt;
+					&lt;string&gt;Insert Tab&lt;/string&gt;
+				&lt;/dict&gt;
+			&lt;/options&gt;
+		&lt;/setup&gt;
+	&lt;/action&gt;
+	
 	&lt;action id=&quot;com.onecrayon.TextActions.FormatText.Em&quot; category=&quot;actions.text.formatting&quot;&gt;
 		&lt;class&gt;TEAforEspresso&lt;/class&gt;
 		&lt;title&gt;Emphasize&lt;/title&gt;
@@ -320,7 +362,7 @@
 		&lt;/setup&gt;
 	&lt;/action&gt;
 	
-	&lt;action id=&quot;com.onecrayon.TextActions.InsertSnippet.HTMLtag&quot; category=&quot;actions.text.HTML/tea.insertion&quot;&gt;
+	&lt;!--&lt;action id=&quot;com.onecrayon.TextActions.InsertSnippet.HTMLtag&quot; category=&quot;actions.text.HTML/tea.insertion&quot;&gt;
 		&lt;class&gt;TEAforEspresso&lt;/class&gt;
 		&lt;title&gt;Insert Tag&lt;/title&gt;
 		&lt;key-equivalent&gt;control W&lt;/key-equivalent&gt;
@@ -334,7 +376,7 @@
 				&lt;/dict&gt;
 			&lt;/options&gt;
 		&lt;/setup&gt;
-	&lt;/action&gt;
+	&lt;/action&gt;--&gt;
 	
 	&lt;action id=&quot;com.onecrayon.TextActions.WrapInSnippet.tag&quot; category=&quot;actions.text.HTML/tea.wrapping&quot;&gt;
 		&lt;class&gt;TEAforEspresso&lt;/class&gt;
@@ -342,7 +384,7 @@
 		&lt;key-equivalent&gt;control W&lt;/key-equivalent&gt;
 		&lt;setup&gt;
 			&lt;action&gt;selections_to_snippets&lt;/action&gt;
-			&lt;selection-context&gt;one&lt;/selection-context&gt;
+			&lt;!-- &lt;selection-context&gt;one&lt;/selection-context&gt; --&gt;
 			&lt;options&gt;
 				&lt;dict&gt;
 					&lt;key&gt;first_snippet&lt;/key&gt;
@@ -358,7 +400,7 @@
 		&lt;key-equivalent&gt;cmd control W&lt;/key-equivalent&gt;
 		&lt;setup&gt;
 			&lt;action&gt;selected_lines_to_snippets&lt;/action&gt;
-			&lt;selection-context&gt;one&lt;/selection-context&gt;
+			&lt;!-- &lt;selection-context&gt;one&lt;/selection-context&gt; --&gt;
 			&lt;options&gt;
 				&lt;dict&gt;
 					&lt;key&gt;first_snippet&lt;/key&gt;
@@ -383,7 +425,7 @@
 		&lt;key-equivalent&gt;control L&lt;/key-equivalent&gt;
 		&lt;setup&gt;
 			&lt;action&gt;insert_url_snippet&lt;/action&gt;
-			&lt;selection-context&gt;one&lt;/selection-context&gt;
+			&lt;!-- &lt;selection-context&gt;one&lt;/selection-context&gt; --&gt;
 			&lt;options&gt;
 				&lt;dict&gt;
 					&lt;key&gt;default&lt;/key&gt;</diff>
      <filename>src/TextActions/Actions.xml</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@
 	&lt;/category&gt;
 	
 	&lt;!-- TEA-specific categories --&gt;
+	&lt;category id=&quot;tea.balance&quot; show=&quot;inline separated&quot;&gt;&lt;/category&gt;
 	&lt;category id=&quot;tea.conversion&quot; show=&quot;inline separated&quot;&gt;&lt;/category&gt;
 	&lt;category id=&quot;tea.insertion&quot; show=&quot;inline separated&quot;&gt;&lt;/category&gt;
 	&lt;category id=&quot;tea.wrapping&quot; show=&quot;inline separated&quot;&gt;&lt;/category&gt;</diff>
      <filename>src/TextActions/Categories.xml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7a26b21db4d93932af7f59275563c7c0e3c2a8bb</id>
    </parent>
    <parent>
      <id>f9a01f211a4825805c185c2470382290f7f240d3</id>
    </parent>
  </parents>
  <author>
    <name>Ian Beck</name>
    <email>ian@onecrayon.com</email>
  </author>
  <url>http://github.com/onecrayon/tea-for-espresso/commit/b94c9648ec7c947c9e7881eb38af95cb9e7a9f5e</url>
  <id>b94c9648ec7c947c9e7881eb38af95cb9e7a9f5e</id>
  <committed-date>2009-10-26T07:54:02-07:00</committed-date>
  <authored-date>2009-10-26T07:54:02-07:00</authored-date>
  <message>Merged in 1.0.2 updates to 1.1 branch</message>
  <tree>90c44ca67b354e1998739fdf51ce5f6564099735</tree>
  <committer>
    <name>Ian Beck</name>
    <email>ian@onecrayon.com</email>
  </committer>
</commit>
