-
Notifications
You must be signed in to change notification settings - Fork 49
Add preserve last search setting and config option #68
Conversation
it "preserves the previous mini editor text", -> | ||
atom.config.set('command-palette.preserveLastSearch', true) | ||
palette.filterEditorView.setText('hello') | ||
palette.cancel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 the semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! Removed!
@50Wliu Any plans for this to get reviewed? |
For what it's worth, I checked this pull request out locally and it seems to be working fine. Can someone with merging capabilities check it out and merge it in so I can use the feature without having a forked version installed?! Thanks! |
@@ -41,6 +55,10 @@ class CommandPaletteView extends SelectListView | |||
@show() | |||
|
|||
show: -> | |||
if @preserveLastSearch | |||
@filterEditorView.setText(@lastSearch) | |||
@filterEditorView.getModel().selectAll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what this line does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It selects the text in the command palette, so if you want to use a different command then you don't need to select it first. Otherwise you can press enter and it will re-use the same command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks.
Also, I notice that the relevant code only seems to be inside the |
It will only preserve what you type into the command palette after it is closed then reopened again, not when you click on one of the items from the menu. The text is stored on cancel and then repopulates the input on open because there was some weird behaviour otherwise (can't remember exactly what though, it was 3 months ago!). |
@tomrw commented on 1 aug. 2016 16:37 CEST:
Probably because |
preserveLastSearch: | ||
type: 'boolean' | ||
default: false | ||
description: 'Preserve the last search when reopening the command palette' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a full-stop at the end of the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full-stop added.
Adds an option which is accessible through the settings to preserve the last text entered into the command palette. This has been extended and improved from here: #46 (comment)