From 04001e44eabd9209cfb8875c62bf73a799d8a662 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 22 Oct 2015 00:21:10 -0400
Subject: [PATCH] set the right canvas state when hiding the search bar

---
 pd/nw/pd_canvas.js | 7 ++++---
 pd/nw/pdgui.js     | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index e63f1d693..c387c4b43 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -896,9 +896,10 @@ function nw_create_patch_window_menus(name) {
                 canvas_events.search();
             } else {
                 find_bar.style.setProperty('display', 'none');
-// this is wrong and causes bug... we need to set back to whatever state
-// we used to be in... probably need a last_state var
-                canvas_events.none();
+                // "normal" seems to be the only viable state for the
+                // canvas atm.  But if there are other states added later,
+                // we might need to fetch the previous state here.
+                canvas_events.normal();
             }
         },
         key: 'f',
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index c8189daba..7186abd35 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2936,7 +2936,6 @@ function gui_textarea(cid, tag, type, x, y, max_char_width, text,
         if (p !== null) {
             p.parentNode.removeChild(p);
         }
-// this is wrong and causes bug... we need it to go back to previous state
         if (patchwin[cid].window.canvas_events.get_previous_state() === 
                'search') {
             patchwin[cid].window.canvas_events.search();
-- 
GitLab