                 else if event.type is 'keyup' and event.altKey and event.which is 38 # Key up
                     if @history_displayed_id < @history.length
                         @history_displayed_id++
-                        @codemirror.setValue @history[@history.length-@history_displayed_id]
+                        @codemirror.setValue @history[@history.length-@history_displayed_id].query
                         event.preventDefault()
                         return true
                 else if event.type is 'keyup' and event.altKey and event.which is 40 # Key down
                     if @history_displayed_id > 1
                         @history_displayed_id--
-                        @codemirror.setValue @history[@history.length-@history_displayed_id]
+                        @codemirror.setValue @history[@history.length-@history_displayed_id].query
                         event.preventDefault()
                         return true
                     else if @history_displayed_id is 1

                query: query_before_cursor
                result: result

            @current_suggestions = []
            if result.suggestions?.length > 0
                for suggestion, i in result.suggestions
                    @current_suggestions.push suggestion

                        @codemirror.setCursor @codemirror.lineCount(), 0 # We hit the draft and put the cursor at the end
                else if event.type is 'keyup' and event.altKey and event.which is 33 # Page up
                    @history_displayed_id = @history.length
                    @codemirror.setValue @history[@history.length-@history_displayed_id].query
                    event.preventDefault()
                    return true
                else if event.type is 'keyup' and event.altKey and event.which is 34 # Page down
                    @history_displayed_id = @history.length
                    @codemirror.setValue @history[@history.length-@history_displayed_id].query
                    @codemirror.setCursor @codemirror.lineCount(), 0 # We hit the draft and put the cursor at the end
                    event.preventDefault()
                    return true
            # If there is a hilighted suggestion, we want to catch enter
            if @$('.suggestion_name_li_hl').length > 0
                if event?.which is 13
