<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Support/environment.rb</filename>
    </added>
    <added>
      <filename>Support/lib/search.rb</filename>
    </added>
    <added>
      <filename>Support/lib/search_dialog.rb</filename>
    </added>
    <added>
      <filename>Support/lib/search_results.rb</filename>
    </added>
    <added>
      <filename>Support/search.css</filename>
    </added>
    <added>
      <filename>Support/search.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,251 +3,15 @@
 &lt;plist version=&quot;1.0&quot;&gt;
 &lt;dict&gt;
 	&lt;key&gt;beforeRunningCommand&lt;/key&gt;
-	&lt;string&gt;saveModifiedFiles&lt;/string&gt;
+	&lt;string&gt;nop&lt;/string&gt;
 	&lt;key&gt;bundleUUID&lt;/key&gt;
 	&lt;string&gt;5A9D4FC6-6CBE-11D9-A21B-000D93589AF6&lt;/string&gt;
 	&lt;key&gt;command&lt;/key&gt;
 	&lt;string&gt;#!/usr/bin/env ruby -rcgi
-
-# By Henrik Nyh &amp;lt;http://henrik.nyh.se&amp;gt; 2007-06-26
-# Free to modify and redistribute with credit.
-
-# Includes some minor modifications by Max &amp;lt;http://max.xaok.org/webtek&amp;gt; 2007-08-01
-# Adds search UI plus some minor modifications by Robert Thurnher &amp;lt;http://soup.robert42.com&amp;gt; 2007-08-11
-# Note: put GrepInProjectSearch.nib into /Applications/TextMate.app/Contents/SharedSupport/Support/nibs/
-# Further modifications by Trevor Squires 
-#
-%w{ui web_preview escape}.each { |lib| require &quot;%s/lib/%s&quot; % [ENV['TM_SUPPORT_PATH'], lib] }
-
-SUPPORT_PATH = ENV['TM_BUNDLE_SUPPORT']
-DIALOG = ENV['DIALOG']
-
-NAME = &quot;Ack in Project&quot;
-HEAD  = &amp;lt;&amp;lt;-HTML
-  &amp;lt;style type=&quot;text/css&quot;&amp;gt;
-    table { font-size:0.9em; border-collapse:collapse; border-bottom:1px solid #555; }
-    h2 { font-size:1.3em; }
-    tr { background:#FFF; }
-    tr.odd { background:#EEE; }
-    td { vertical-align:top; white-space:nowrap; padding:0.4em 1em; color:#000 !important; }
-    tr td:first-child { text-align:right; padding-right:1.5em; }
-    td a { color:#00F !important; }
-    tr.binary { background:#E8AFA8; }
-    tr.binary.odd { background:#E0A7A2; }
-    tr#empty { border-bottom:1px solid #FFF; }
-    tr#empty td { text-align:center; }
-    tr.newFile, tr.binary { border-top:1px solid #555; }
-    .keyword { font-weight:bold; background:#F6D73A; margin:0 0.1em; }
-    .ellipsis { color:#777; margin:0 0.5em; }
-  &amp;lt;/style&amp;gt;
-  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
-    function reveal_file(path) {
-      const quote = '&quot;';
-      const command = &quot;osascript -e ' tell app &quot;+quote+&quot;Finder&quot;+quote+&quot;' &quot; +
-                        &quot; -e 'reveal (POSIX file &quot; +quote+path+quote + &quot;)' &quot; +
-                        &quot; -e 'activate' &quot; + 
-                      &quot; -e 'end' &quot;;
-      TextMate.system(command, null);
-    }
-
-  function findPos(obj) {
-    var curleft = curtop = 0;
-    if (obj.offsetParent) {
-      curleft = obj.offsetLeft
-      curtop = obj.offsetTop
-      while (obj = obj.offsetParent) {
-        curleft += obj.offsetLeft
-        curtop += obj.offsetTop
-      }
-    }
-    return {left: curleft, top: curtop};
-  }
-  
-  function resizeTableToFit() {
-    var table = document.getElementsByTagName(&quot;table&quot;)[0];
-    const minWidth = 450, minHeight = 250;
-
-    var pos = findPos(table);
-    var tableFitWidth = table.offsetWidth + pos.left * 2;
-    var tableFitHeight = table.offsetHeight + pos.top + 50;
-    var screenFitWidth = screen.width - 150;
-    var screenFitHeight = screen.height - 150;
-
-    var setWidth = tableFitWidth &amp;gt; screenFitWidth ? screenFitWidth : tableFitWidth;
-    var setHeight = tableFitHeight &amp;gt; screenFitHeight ? screenFitHeight : tableFitHeight;  
-    setWidth = setWidth &amp;lt; minWidth ? minWidth : setWidth;
-    setHeight = setHeight &amp;lt; minHeight ? minHeight : setHeight;
-
-    window.resizeTo(setWidth, setHeight);
-  }
-  
-  &amp;lt;/script&amp;gt;
-HTML
-
-RESIZE_TABLE = &amp;lt;&amp;lt;-HTML
-  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
-    resizeTableToFit();
-  &amp;lt;/script&amp;gt;
-HTML
-
-def ellipsize_path(path)
-  path.sub(/^(.{30})(.{10,})(.{30})$/) { &quot;#$1&#8943;#$3&quot; }
+require ENV['TM_BUNDLE_SUPPORT'] + '/environment.rb'
+AckInProject.show_search_dialog do |search_options|
+  AckInProject.present_search(search_options)
 end
-
-def escape(string)
-  CGI.escapeHTML(string)
-end
-
-def bail(message)
-  puts &amp;lt;&amp;lt;-HTML
-    &amp;lt;h2&amp;gt;#{ message }&amp;lt;/h2&amp;gt;
-  HTML
-  html_footer
-  exit
-end
-
-ack_command = ENV['TM_ACK'] || 'ack'
-
-directory = ENV['TM_SELECTED_FILE'] || ENV['TM_PROJECT_DIRECTORY'] || 
-            ( ENV['TM_FILEPATH'] &amp;amp;&amp;amp; File.dirname(ENV['TM_FILEPATH']) )
-
-directory = if File.file? directory then
-   ENV['TM_PROJECT_DIRECTORY']
-else
-   directory
-end
-
-searched_in = directory.gsub(/^#{ENV['TM_PROJECT_DIRECTORY']}/, File.basename(ENV['TM_PROJECT_DIRECTORY']))
-
-puts html_head(
-  :window_title =&amp;gt; NAME,
-  :page_title   =&amp;gt; NAME,
-  :sub_title    =&amp;gt; directory || &quot;Error&quot;,
-  :html_head    =&amp;gt; HEAD
-)
-
-bail(&quot;Not in a saved file&quot;) unless directory
-
-tm_dialog_command = %{#{DIALOG} --center --parameters '{ ignoreCaseBoolean = 1; fileTypeString = &quot;*.*&quot;; }' '#{SUPPORT_PATH}/nibs/AckInProjectSearch.nib'}
-
-plist = OSX::PropertyList.load(IO.popen(tm_dialog_command))
-
-query = plist['searchString']
-file_type = plist['fileTypeString']
-use_extended_regexp = plist['useExtendedRegularExpressionBoolean']
-ignore_case = plist['ignoreCaseBoolean']
-
-if !file_type
-  file_type = '*.*'
-end
-file_type = file_type.gsub(/\s/, '')
-if !file_type.match(/,/)
-  include_flags = %{ --include='#{file_type}' }
-else
-  file_types = file_type.split(',')
-  include_flags = ' '
-  for f in file_types
-    include_flags += %{--include='#{f}' }
-  end
-end
-if (ignore_case == '1')
-  ignore_case = 1
-end
-use_extended_regexp == 1 ? pattern_interpretation_flag = ' --extended-regexp' : pattern_interpretation_flag = ' --fixed-strings'
-(ignore_case == 1 &amp;amp;&amp;amp; (!use_extended_regexp || use_extended_regexp == 0)) ? ignore_case_flag = '--ignore-case' : ignore_case_flag = ''
-
-bail(&quot;Search aborted&quot;) unless query
-
-puts &amp;lt;&amp;lt;-HTML
-  &amp;lt;h2&amp;gt;Searching for &#8220;#{ escape(query) }&#8221; in #{ searched_in }&amp;lt;/h2&amp;gt;
-  &amp;lt;table&amp;gt;
-HTML
-
-# TODO: Respect ENV['TM_SELECTED_FILES']
-command = %{cd &quot;#{directory}&quot;; #{ack_command} -H --nogroup --nocolor #{e_sh query}}
-
-IO.popen(command) do |pipe|
-
-  # Used to highlight matches
-  if (use_extended_regexp == 1)
-    query_re = Regexp.new(query)
-  elsif (ignore_case == 0 &amp;amp;&amp;amp; (!use_extended_regexp || use_extended_regexp == 0))
-    query_re = Regexp.new( Regexp.escape(CGI.escapeHTML(query)) )
-  else
-    query_re = Regexp.new( Regexp.escape(CGI.escapeHTML(query)), Regexp::IGNORECASE)
-  end
-
-  last_path = path = i = nil
-  pipe.each_with_index do |line, i|
-
-    if line =~ /^(Binary file )(.*?) matches/
-      prefix, file = $1, $2
-      path = directory + '/' + file
-      puts &amp;lt;&amp;lt;-HTML
-        &amp;lt;tr class=&quot;binary #{ 'odd' unless i%2==0 }&quot;&amp;gt;
-          &amp;lt;td&amp;gt;
-            #{ prefix }
-            &amp;lt;a href=&quot;javascript:reveal_file('#{ escape(path) }')&quot; title=&quot;#{ escape(path) }&quot;&amp;gt;#{ ellipsize_path(file) }&amp;lt;/a&amp;gt;
-          &amp;lt;/td&amp;gt;
-          &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
-        &amp;lt;/tr&amp;gt;
-        #{ RESIZE_TABLE if i%100==0 }
-      HTML
-      next
-    end
-
-    line.gsub!(/^([^:]+):(\d+):(.*)$/) do
-
-      relative_path, line_number, content = $1, $2, $3.strip
-      path = directory + '/' + relative_path
-      url = &quot;txmt://open/?url=file://#{path}&amp;amp;line=#{line_number}&quot;
-      
-      content = escape(content).
-                  # Highlight keywords
-                  gsub(query_re) { %{&amp;lt;strong class=&quot;keyword&quot;&amp;gt;#$&amp;amp;&amp;lt;/strong&amp;gt;} }.
-                  # Ellipsize before, between and after keywords
-                  gsub(%r{(^[^&amp;lt;]{25}|&amp;lt;/strong&amp;gt;[^&amp;lt;]{15})([^&amp;lt;]{20,})([^&amp;lt;]{15}&amp;lt;strong|[^&amp;lt;]{25}$)}) do
-                    %{#$1&amp;lt;span class=&quot;ellipsis&quot; title=&quot;#{escape($2)}&quot;&amp;gt;&#8943;&amp;lt;/span&amp;gt;#$3}
-                  end
-      &amp;lt;&amp;lt;-HTML
-
-        &amp;lt;tr class=&quot;#{ 'odd' unless i%2==0 } #{ 'newFile' if (path != last_path) }&quot;&amp;gt;
-          &amp;lt;td&amp;gt;
-            &amp;lt;a href=&quot;#{ url }&quot; title=&quot;#{ &quot;%s:%s&quot; % [path, line_number] }&quot;&amp;gt;
-              #{ &quot;%s:%s&quot; % [ellipsize_path(relative_path), line_number] }
-            &amp;lt;/a&amp;gt;
-          &amp;lt;/td&amp;gt;
-          &amp;lt;td&amp;gt;#{ content }&amp;lt;/td&amp;gt;
-        &amp;lt;/tr&amp;gt;
-
-      HTML
-    end
-    puts line
-    last_path = path
-
-  end
-
-  if i
-    # A paragraph inside the table ends up at the top even though it's output
-    # at the end. Something of a hack 
-    i += 1
-    puts &amp;lt;&amp;lt;-HTML
-      &amp;lt;p&amp;gt;#{i} matching line#{i==1 ? '' : 's'}:&amp;lt;/p&amp;gt;
-      #{RESIZE_TABLE}
-    HTML
-  else
-    puts &amp;lt;&amp;lt;-HTML
-      &amp;lt;tr id=&quot;empty&quot;&amp;gt;&amp;lt;td colspan=&quot;2&quot;&amp;gt;No results.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
-    HTML
-  end
-    
-end
-
-puts &amp;lt;&amp;lt;-HTML
-&amp;lt;/table&amp;gt;
-HTML
-
-html_footer
 &lt;/string&gt;
 	&lt;key&gt;input&lt;/key&gt;
 	&lt;string&gt;none&lt;/string&gt;</diff>
      <filename>Commands/AckInProject.tmCommand</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>Support/nibs/AckInProjectSearch.nib/keyedobjects.nib</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e7b46084fafa23fe86ff721cab3d23f067de3ab3</id>
    </parent>
  </parents>
  <author>
    <name>Trevor Squires</name>
    <email>trevor@protocool.com</email>
  </author>
  <url>http://github.com/protocool/ack-tmbundle/commit/4bcaac7511d98d87549ee4ed6c369048f1ed27ce</url>
  <id>4bcaac7511d98d87549ee4ed6c369048f1ed27ce</id>
  <committed-date>2008-05-21T18:30:51-07:00</committed-date>
  <authored-date>2008-05-21T18:30:51-07:00</authored-date>
  <message>complete overhaul plus ack specific features</message>
  <tree>6aea0f3163618043576278ee078db8ebd03490d7</tree>
  <committer>
    <name>Trevor Squires</name>
    <email>trevor@protocool.com</email>
  </committer>
</commit>
