Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle ace_replace_form using CMD-f no longer available #3552

Closed
vnijs opened this issue Feb 6, 2018 · 2 comments
Closed

Toggle ace_replace_form using CMD-f no longer available #3552

vnijs opened this issue Feb 6, 2018 · 2 comments

Comments

@vnijs
Copy link

vnijs commented Feb 6, 2018

In version 1.1.8 CMD-f (CTRL-f in Windows) would open search and then toggle the replace form. In 1.2.9 and 1.3.0 CMD-f (CTRL-f in Windows) will hide the replace form if shown but will not show it. Is this intended behavior? If so, is it customizable? I tried using jQuery with keydown but it didn't seem to have any effect. I do see there is CMD-Opt-f (Ctrl-H) but I liked the toggle option better ... and it is already mapped to Spectacle on Mac :)

@nightwing
Copy link
Member

I liked toggling behavior better too. But many people were complaining about it since they often press the shortcut without looking where the focus is, just to make sure the findbar is focused, and most of other editors do not have the toggling.

You can use the following code to restore toggling behavior

require("ace/ext/searchbox").SearchBox.prototype.$searchBarKb.bindKey( "Ctrl-f|Command-f|Ctrl-H|Command-Option-F", function(sb) {
    var isReplace = sb.isReplace = !sb.isReplace;
    sb.replaceBox.style.display = isReplace ? "" : "none";
    sb[isReplace ? "replaceInput" : "searchInput"].focus();
})

In ace-builds version this needs to run after the searchbox extension is loaded.

@vnijs
Copy link
Author

vnijs commented Feb 7, 2018

Excellent! Thank you @nightwing

@vnijs vnijs closed this as completed Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants