From 378a72a91ca9793ae6c83acfa055a35ee272d1ca Mon Sep 17 00:00:00 2001 From: Colton Voege Date: Wed, 17 Sep 2014 13:33:29 -0400 Subject: [PATCH 1/2] Added Find All functionality to searchbox. --- lib/ace/ext/searchbox.css | 2 +- lib/ace/ext/searchbox.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/ace/ext/searchbox.css b/lib/ace/ext/searchbox.css index ca58e74d..5de8d847 100644 --- a/lib/ace/ext/searchbox.css +++ b/lib/ace/ext/searchbox.css @@ -7,7 +7,7 @@ background-color: #ddd; border: 1px solid #cbcbcb; border-top: 0 none; - max-width: 297px; + max-width: 325px; overflow: hidden; margin: 0; padding: 4px; diff --git a/lib/ace/ext/searchbox.js b/lib/ace/ext/searchbox.js index fbbaa8f3..c306c81e 100644 --- a/lib/ace/ext/searchbox.js +++ b/lib/ace/ext/searchbox.js @@ -46,6 +46,7 @@ var html = '\
\ \ @@ -170,6 +171,11 @@ var SearchBox = function(editor, range, showReplaceForm) { sb.replace(); sb.findPrev(); }, + "Alt-Return": function(sb) { + if (sb.activeInput == sb.replaceInput) + sb.replace(); + sb.findAll(); + }, "Tab": function(sb) { (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus(); } @@ -229,6 +235,18 @@ var SearchBox = function(editor, range, showReplaceForm) { this.findPrev = function() { this.find(true, true); }; + this.findAll = function(){ + var range = this.editor.findAll(this.searchInput.value, { + regExp: this.regExpOption.checked, + caseSensitive: this.caseSensitiveOption.checked, + wholeWord: this.wholeWordOption.checked + }); + var noMatch = !range && this.searchInput.value; + dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); + this.editor._emit("findSearchBox", { match: !noMatch }); + this.highlight(); + this.hide(); + }; this.replace = function() { if (!this.editor.getReadOnly()) this.editor.replace(this.replaceInput.value); From 4b44bad6876a7f1cadf35c387190feaf772093ad Mon Sep 17 00:00:00 2001 From: Colton Voege Date: Thu, 25 Sep 2014 12:57:32 -0400 Subject: [PATCH 2/2] Replace all with Alt-Enter fixed. --- lib/ace/ext/searchbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/ext/searchbox.js b/lib/ace/ext/searchbox.js index c306c81e..0369f2d0 100644 --- a/lib/ace/ext/searchbox.js +++ b/lib/ace/ext/searchbox.js @@ -173,7 +173,7 @@ var SearchBox = function(editor, range, showReplaceForm) { }, "Alt-Return": function(sb) { if (sb.activeInput == sb.replaceInput) - sb.replace(); + sb.replaceAll(); sb.findAll(); }, "Tab": function(sb) {