<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -30,3 +30,4 @@ RELEASE
  - [X] emptying the query should empty the search terms
  - [ ] deal with shortcut key conflicts
  - [X] if no results show helpful messages
+ - [X] don't allow enter until search completes</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,9 @@ var searchy = new function() {
   var $ = function(x) { return document.getElementById(x); };
 
   var req;
+  var current;
+  var queried;
+  var timer;
 
   this.go = function() {
     var panel = $('searchy');
@@ -16,15 +19,9 @@ var searchy = new function() {
     openUILinkIn('http://overstimulate.com/projects/searchy', 'tab');
   };
 
-  var timer;
-
   this.input = function(aEvent) {
-    if (req) {
-      req.abort();
-    }
-    if (timer) {
-      clearTimeout(timer);
-    }
+    if (req) req.abort();
+    if (timer) clearTimeout(timer);
 
     if ($('searchy-input').value == '') {
       return help();
@@ -65,7 +62,9 @@ var searchy = new function() {
   function inputlistener(aEvent) {
     switch (aEvent.keyCode) {
       case aEvent.DOM_VK_RETURN:
-        visit(current, aEvent);
+        if (queried == $('searchy-input').value) {
+          visit(current, aEvent);
+        }
         break;
       case aEvent.DOM_VK_UP:
         if (current) { select(current.previousSibling); }
@@ -88,7 +87,7 @@ var searchy = new function() {
   };
 
   this.hidden = function() {
-    if (req) { req.abort(); }
+    if (req) req.abort();
     window.removeEventListener('keypress', inputlistener, true);
 
     /* because the MAC doesn't redraw xul that has a panel over it you are left with crap */
@@ -117,20 +116,10 @@ var searchy = new function() {
   }
 
   function query(input) {
-    if (req) {
-      req.abort();
-    }
-
-    req = Cc[&quot;@mozilla.org/xmlextras/xmlhttprequest;1&quot;]
-      .createInstance(Ci.nsIXMLHttpRequest);
-    req.mozBackgroundRequest = true;
-    req.open(&quot;GET&quot;, urlFor(input));
-    req.onreadystatechange = process;
-    req.send(null);
+    if (req) req.abort();
+    req = new Request(input);
   }
 
-  var current;
-
   function noresults() {
     done();
     $('searchy-no-results').hidden = false;
@@ -160,7 +149,7 @@ var searchy = new function() {
   }
 
   function process() {
-    if ((req.readyState == 4) &amp;&amp; (req.status == 200)) {
+    if (req &amp;&amp; (req.xhr.readyState == 4) &amp;&amp; (req.xhr.status == 200)) {
       done();
 
       var box = $('searchy-results');
@@ -169,7 +158,7 @@ var searchy = new function() {
         var nsJSON = Cc[&quot;@mozilla.org/dom/json;1&quot;]
           .createInstance(Ci.nsIJSON);
 
-        var json = nsJSON.decode(req.responseText);
+        var json = nsJSON.decode(req.xhr.responseText);
 
         if (!json.ysearchresponse.resultset_web) {
           return noresults();
@@ -180,6 +169,7 @@ var searchy = new function() {
       }
 
       current = null;
+      queried = req.input;
 
       if (json.ysearchresponse.resultset_web.length == 0) {
         return noresults();
@@ -211,6 +201,20 @@ var searchy = new function() {
     }
   }
 
+  function Request(input)  {
+    var xhr = Cc[&quot;@mozilla.org/xmlextras/xmlhttprequest;1&quot;]
+      .createInstance(Ci.nsIXMLHttpRequest);
+    xhr.mozBackgroundRequest = true;
+    xhr.open(&quot;GET&quot;, urlFor(input));
+    xhr.onreadystatechange = process;
+    xhr.send(null);
+
+    this.input = input;
+    this.abort = function() { xhr.abort(); };
+    this.xhr = xhr;
+  }
+
+
   function appendHTMLtoXUL(html, node) {
     html.split(/&lt;b&gt;(.*?&lt;\/b&gt;)|([^&lt;]*)/).forEach(
       function(text) {</diff>
      <filename>chrome/content/overlay.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b567488e4863c8254c90a17202bc3187d4913867</id>
    </parent>
  </parents>
  <author>
    <name>Jesse Andrews</name>
    <email>jesse@mac-mini.local</email>
  </author>
  <url>http://github.com/anotherjesse/searchy/commit/a0e94d56c927a6a1719badc48528b3d953fcae1d</url>
  <id>a0e94d56c927a6a1719badc48528b3d953fcae1d</id>
  <committed-date>2008-12-13T21:30:51-08:00</committed-date>
  <authored-date>2008-12-13T21:30:51-08:00</authored-date>
  <message>enter doesn't do anything until search is complete</message>
  <tree>0cd409d4e2977b34577b5765c07348508e829500</tree>
  <committer>
    <name>Jesse Andrews</name>
    <email>jesse@mac-mini.local</email>
  </committer>
</commit>
