 ProjectSearchSettings = rclass
 
     propTypes :
-        checkboxes : rtypes.object
+        checkboxes      : rtypes.object
+        toggle_checkbox : rtypes.func
+        search_cb       : rtypes.func
+
+    getInitialState: ->
+        case_sensitive  : false    # do not change any of these to true without also changing
+        subdirectories  : false    # the "@checkbox_state={}" below.
+        hidden_files    : false
 
     handle_change : (name) ->
-        project_store.getActions(@props.project_id, flux).setTo("#{name}": @refs[name].getChecked())
-
-    input : (name, label) ->
+        @props.toggle_checkbox(name)
+        @setState("#{name}":not @state[name])
+
+    render_checkbox : (name, label) ->
         <Input
             ref      = {name}
             key      = {name}
             type     = 'checkbox'
             label    = {label}
-            checked  = {@props[name]}
+            checked  = {@state[name]}
             onChange = {=>@handle_change(name)}
             style    = {fontSize:'16px'} />
 
     render : ->
         <div style={fontSize:'16px'}>
-            {(@input(name, label) for name, label of @props.checkboxes)}
+            {(@render_checkbox(name, label) for name, label of @props.checkboxes)}
         </div>
 
 
 ProjectSearchDisplay = rclass
 
+    getInitialState : ->
+        user_input         : ''
+        search_results     : undefined
+        search_error       : undefined
+        too_many_results   : false
+        command            : undefined
+        most_recent_search : undefined
+        most_recent_path   : undefined
+
+    componentWillMount: ->
+        if not @checkbox_state?
+            @checkbox_state = {}
+
+    toggle_checkbox : (checkbox) ->
+        @checkbox_state[checkbox] = not @checkbox_state[checkbox]
+        @search()
+
     propTypes: ->
-        user_input : rtypes.string
         project_id : rtypes.string
 
     settings_checkboxes :

        return cmd


    search : (query) ->
        if query.trim() == ''
            return

        cmd = @generate_command(query, @props.subdirectories, not @props.case_sensitive, @props.hidden_files)
        max_results = 1000
        max_output  = 110 * max_results  # just in case

        project_store.getActions(@props.project_id, flux).setTo
            search_results     : undefined
            search_error       : undefined
            command            : cmd

            <Icon name="times-circle" />
        </Button>

    handle_change : ->
        user_input = @refs.project_search_input.getValue()
        @setState(user_input : user_input)
        @props.set_state_cb(user_input : user_input)

    submit : (event) ->
        event.preventDefault()
        @props.search_cb?()

    render : ->
        <form onSubmit={@submit}>
