Minimal UI for Find+Replace, issue 56.
The API is there, the shortcut is there as well (Ctrl-R) but the command does not exist, so added a minimal implementation, just Find has one.
This commit is contained in:
parent
7ed9cb2f57
commit
f517bf9717
1 changed files with 27 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* vim:ts=4:sts=4:sw=4:
|
||||||
|
* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
|
@ -21,6 +22,7 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
* Julian Viereck <julian.viereck@gmail.com>
|
* Julian Viereck <julian.viereck@gmail.com>
|
||||||
|
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
|
@ -82,6 +84,30 @@ canon.addCommand({
|
||||||
env.editor.find(needle);
|
env.editor.find(needle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
canon.addCommand({
|
||||||
|
name: "replace",
|
||||||
|
exec: function(env, args, request) {
|
||||||
|
var needle = prompt("Find:");
|
||||||
|
if (!needle)
|
||||||
|
return;
|
||||||
|
var replacement = prompt("Replacement:");
|
||||||
|
if (!replacement)
|
||||||
|
return;
|
||||||
|
env.editor.replace(replacement, {needle: needle});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
canon.addCommand({
|
||||||
|
name: "replaceall",
|
||||||
|
exec: function(env, args, request) {
|
||||||
|
var needle = prompt("Find:");
|
||||||
|
if (!needle)
|
||||||
|
return;
|
||||||
|
var replacement = prompt("Replacement:");
|
||||||
|
if (!replacement)
|
||||||
|
return;
|
||||||
|
env.editor.replaceAll(replacement, {needle: needle});
|
||||||
|
}
|
||||||
|
});
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "undo",
|
name: "undo",
|
||||||
exec: function(env, args, request) { env.editor.undo(); }
|
exec: function(env, args, request) { env.editor.undo(); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue