Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add preserve last search setting and config option #68

Merged
merged 1 commit into from
Oct 3, 2016
Merged

Add preserve last search setting and config option #68

merged 1 commit into from
Oct 3, 2016

Conversation

tomrw
Copy link
Contributor

@tomrw tomrw commented May 17, 2016

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)

screen shot 2016-05-17 at 22 51 16

it "preserves the previous mini editor text", ->
atom.config.set('command-palette.preserveLastSearch', true)
palette.filterEditorView.setText('hello')
palette.cancel();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 the semicolon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah! Removed!

@tomrw
Copy link
Contributor Author

tomrw commented Jun 14, 2016

@50Wliu Any plans for this to get reviewed?

@tnrich
Copy link

tnrich commented Aug 1, 2016

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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks.

@winstliu
Copy link
Contributor

winstliu commented Aug 1, 2016

Also, I notice that the relevant code only seems to be inside the cancel function. Does this still work when you select an option from the Command Palette and then open it again?

@tomrw
Copy link
Contributor Author

tomrw commented Aug 1, 2016

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!).

@jerone
Copy link

jerone commented Aug 2, 2016

@tomrw commented on 1 aug. 2016 16:37 CEST:

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!).

Probably because cancel is called both on canceling and on confirming.

preserveLastSearch:
type: 'boolean'
default: false
description: 'Preserve the last search when reopening the command palette'
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full-stop added.

@damieng damieng merged commit 1bd7b74 into atom:master Oct 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants