             <Icon name="times-circle" />
         </Button>
 
-    handle_change : (event) ->
-        @setState(user_input : event.target.value)
-
-    submit : (e) ->
-        e.preventDefault()
-        project_store.getActions(@props.project_id, flux).setTo(user_input : @state.user_input)
-        @props.search_cb(@state.user_input)
+    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}>

ProjectSearchSettings = rclass

    propTypes :
        checkboxes : rtypes.object

    handle_change : (name) ->
        project_store.getActions(@props.project_id, flux).setTo("#{name}": @refs[name].getChecked())

    input : (name, label) ->
        <Input
            ref      = {name}
            key      = {name}
            type     = 'checkbox'
            label    = {label}
            checked  = {@props[name]}
            onChange = {=>@handle_change(name)}
            style    = {fontSize:'16px'} />

    render : ->
        <div style={fontSize:'16px'}>
            {(@input(name, label) for name, label of @props.checkboxes)}
        </div>


ProjectSearchDisplay = rclass

    propTypes: ->
        user_input : rtypes.string
        project_id : rtypes.string

    settings_checkboxes :

        return cmd


    search : ->
        query = @state.user_input
        if query.trim() == ''
            @setState
                search_results     : []
                search_error       : undefined
                command            : ""
                most_recent_search : ""
                most_recent_path   : @props.current_path.join("/")
            return

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

        @setState
            search_results     : undefined
            search_error       : undefined
            command            : cmd
