mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-28 07:42:26 +01:00
Use 'find' terminology for page search to differentiate from web search.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
/** @instance rangefinder */
|
||||
const RangeFinder = Module("rangefinder", {
|
||||
init: function () {
|
||||
this.lastSearchPattern = "";
|
||||
this.lastFindPattern = "";
|
||||
},
|
||||
|
||||
openPrompt: function (mode) {
|
||||
@@ -29,8 +29,8 @@ const RangeFinder = Module("rangefinder", {
|
||||
let selections = this.rangeFind && this.rangeFind.selections;
|
||||
let linksOnly = false;
|
||||
let regexp = false;
|
||||
let matchCase = options["searchcase"] === "smart" ? /[A-Z]/.test(str) :
|
||||
options["searchcase"] === "ignore" ? false : true;
|
||||
let matchCase = options["findcase"] === "smart" ? /[A-Z]/.test(str) :
|
||||
options["findcase"] === "ignore" ? false : true;
|
||||
|
||||
str = str.replace(/\\(.|$)/g, function (m, n1) {
|
||||
if (n1 == "c")
|
||||
@@ -65,12 +65,12 @@ const RangeFinder = Module("rangefinder", {
|
||||
this.rangeFind.highlighted = highlighted;
|
||||
this.rangeFind.selections = selections;
|
||||
}
|
||||
return this.lastSearchPattern = str;
|
||||
return this.lastFindPattern = str;
|
||||
},
|
||||
|
||||
find: function (pattern, backwards) {
|
||||
let str = this.bootstrap(pattern, backwards);
|
||||
if (!this.rangeFind.search(str))
|
||||
if (!this.rangeFind.find(str))
|
||||
this.timeout(function () { dactyl.echoerr("E486: Pattern not found: " + pattern); }, 0);
|
||||
|
||||
return this.rangeFind.found;
|
||||
@@ -78,47 +78,47 @@ const RangeFinder = Module("rangefinder", {
|
||||
|
||||
findAgain: function (reverse) {
|
||||
if (!this.rangeFind)
|
||||
this.find(this.lastSearchPattern);
|
||||
else if (!this.rangeFind.search(null, reverse))
|
||||
dactyl.echoerr("E486: Pattern not found: " + this.lastSearchPattern);
|
||||
this.find(this.lastFindPattern);
|
||||
else if (!this.rangeFind.find(null, reverse))
|
||||
dactyl.echoerr("E486: Pattern not found: " + this.lastFindPattern);
|
||||
else if (this.rangeFind.wrapped)
|
||||
// hack needed, because wrapping causes a "scroll" event which
|
||||
// clears our command line
|
||||
this.timeout(function () {
|
||||
let msg = this.rangeFind.backward ? "search hit TOP, continuing at BOTTOM"
|
||||
: "search hit BOTTOM, continuing at TOP";
|
||||
let msg = this.rangeFind.backward ? "find hit TOP, continuing at BOTTOM"
|
||||
: "find hit BOTTOM, continuing at TOP";
|
||||
commandline.echo(msg, commandline.HL_WARNINGMSG,
|
||||
commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE);
|
||||
}, 0);
|
||||
else
|
||||
commandline.echo((this.rangeFind.backward ? "?" : "/") + this.lastSearchPattern, null, commandline.FORCE_SINGLELINE);
|
||||
commandline.echo((this.rangeFind.backward ? "?" : "/") + this.lastFindPattern, null, commandline.FORCE_SINGLELINE);
|
||||
|
||||
if (options["hlsearch"])
|
||||
if (options["hlfind"])
|
||||
this.highlight();
|
||||
this.rangeFind.focus();
|
||||
},
|
||||
|
||||
// Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set
|
||||
// Called when the user types a key in the find dialog. Triggers a find attempt if 'incfind' is set
|
||||
onKeyPress: function (command) {
|
||||
if (options["incsearch"]) {
|
||||
if (options["incfind"]) {
|
||||
command = this.bootstrap(command);
|
||||
this.rangeFind.search(command);
|
||||
this.rangeFind.find(command);
|
||||
}
|
||||
},
|
||||
|
||||
onSubmit: function (command) {
|
||||
if (!options["incsearch"] || !this.rangeFind || !this.rangeFind.found) {
|
||||
if (!options["incfind"] || !this.rangeFind || !this.rangeFind.found) {
|
||||
this.clear();
|
||||
this.find(command || this.lastSearchPattern, modes.extended & modes.FIND_BACKWARD);
|
||||
this.find(command || this.lastFindPattern, modes.extended & modes.FIND_BACKWARD);
|
||||
}
|
||||
|
||||
if (options["hlsearch"])
|
||||
if (options["hlfind"])
|
||||
this.highlight();
|
||||
this.rangeFind.focus();
|
||||
},
|
||||
|
||||
// Called when the search is canceled - for example if someone presses
|
||||
// escape while typing a search
|
||||
// Called when the find is canceled - for example if someone presses
|
||||
// escape while typing a find
|
||||
onCancel: function () {
|
||||
if (this.rangeFind)
|
||||
this.rangeFind.cancel();
|
||||
@@ -128,7 +128,7 @@ const RangeFinder = Module("rangefinder", {
|
||||
set rangeFind(val) buffer.localStore.rangeFind = val,
|
||||
|
||||
/**
|
||||
* Highlights all occurrences of the last searched for string in the
|
||||
* Highlights all occurrences of the last finded for string in the
|
||||
* current buffer.
|
||||
*/
|
||||
highlight: function () {
|
||||
@@ -137,7 +137,7 @@ const RangeFinder = Module("rangefinder", {
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears all search highlighting.
|
||||
* Clears all find highlighting.
|
||||
*/
|
||||
clear: function () {
|
||||
if (this.rangeFind)
|
||||
@@ -159,8 +159,8 @@ const RangeFinder = Module("rangefinder", {
|
||||
commandline.registerCallback("cancel", modes.FIND_BACKWARD, this.closure.onCancel);
|
||||
},
|
||||
commands: function () {
|
||||
commands.add(["noh[lsearch]"],
|
||||
"Remove the search highlighting",
|
||||
commands.add(["noh[lfind]"],
|
||||
"Remove the find highlighting",
|
||||
function () { rangefinder.clear(); },
|
||||
{ argCount: "0" });
|
||||
},
|
||||
@@ -168,11 +168,11 @@ const RangeFinder = Module("rangefinder", {
|
||||
var myModes = config.browserModes.concat([modes.CARET]);
|
||||
|
||||
mappings.add(myModes,
|
||||
["/"], "Search forward for a pattern",
|
||||
["/"], "Find a pattern starting at the current caret position",
|
||||
function () { rangefinder.openPrompt(modes.FIND_FORWARD); });
|
||||
|
||||
mappings.add(myModes,
|
||||
["?"], "Search backwards for a pattern",
|
||||
["?"], "Find a pattern backward of the current caret position",
|
||||
function () { rangefinder.openPrompt(modes.FIND_BACKWARD); });
|
||||
|
||||
mappings.add(myModes,
|
||||
@@ -203,8 +203,8 @@ const RangeFinder = Module("rangefinder", {
|
||||
// The above should be sufficient, but: https://bugzilla.mozilla.org/show_bug.cgi?id=348187
|
||||
prefs.safeSet("accessibility.typeaheadfind", false);
|
||||
|
||||
options.add(["hlsearch", "hls"],
|
||||
"Highlight all /search pattern matches on the current page after a search",
|
||||
options.add(["hlfind", "hlf"],
|
||||
"Highlight all /find pattern matches on the current page after submission",
|
||||
"boolean", false, {
|
||||
setter: function (value) {
|
||||
try {
|
||||
@@ -219,8 +219,8 @@ const RangeFinder = Module("rangefinder", {
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["searchcase", "sc"],
|
||||
"Search case matching mode",
|
||||
options.add(["findcase", "fc"],
|
||||
"Find case matching mode",
|
||||
"string", "smart",
|
||||
{
|
||||
completer: function () [
|
||||
@@ -230,8 +230,8 @@ const RangeFinder = Module("rangefinder", {
|
||||
]
|
||||
});
|
||||
|
||||
options.add(["incsearch", "is"],
|
||||
"Search for a pattern incrementally as it is typed rather than awaiting <Return>",
|
||||
options.add(["incfind", "if"],
|
||||
"Find a pattern incrementally as it is typed rather than awaiting <Return>",
|
||||
"boolean", true);
|
||||
}
|
||||
});
|
||||
@@ -240,21 +240,21 @@ const RangeFinder = Module("rangefinder", {
|
||||
* @class RangeFind
|
||||
*
|
||||
* A fairly sophisticated typeahead-find replacement. It supports
|
||||
* incremental search very much as the builtin component.
|
||||
* incremental find very much as the builtin component.
|
||||
* Additionally, it supports several features impossible to
|
||||
* implement using the standard component. Incremental searching
|
||||
* implement using the standard component. Incremental finding
|
||||
* works both forwards and backwards. Erasing characters during an
|
||||
* incremental search moves the selection back to the first
|
||||
* incremental find moves the selection back to the first
|
||||
* available match for the shorter term. The selection and viewport
|
||||
* are restored when the search is canceled.
|
||||
* are restored when the find is canceled.
|
||||
*
|
||||
* Also, in addition to full support for frames and iframes, this
|
||||
* implementation will begin searching from the position of the
|
||||
* implementation will begin finding from the position of the
|
||||
* caret in the last active frame. This is contrary to the behavior
|
||||
* of the builtin component, which always starts a search from the
|
||||
* of the builtin component, which always starts a find from the
|
||||
* beginning of the first frame in the case of frameset documents,
|
||||
* and cycles through all frames from beginning to end. This makes it
|
||||
* impossible to choose the starting point of a search for such
|
||||
* impossible to choose the starting point of a find for such
|
||||
* documents, and represents a major detriment to productivity where
|
||||
* large amounts of data are concerned (e.g., for API documents).
|
||||
*/
|
||||
@@ -292,7 +292,7 @@ const RangeFind = Class("RangeFind", {
|
||||
}
|
||||
},
|
||||
|
||||
get searchString() this.lastString,
|
||||
get findString() this.lastString,
|
||||
|
||||
get selectedRange() {
|
||||
let selection = (buffer.focusedFrame || content).getSelection();
|
||||
@@ -411,7 +411,7 @@ const RangeFind = Class("RangeFind", {
|
||||
this.lastRange = null;
|
||||
this.lastString = word;
|
||||
var res;
|
||||
while (res = this.search(null, this.reverse, true))
|
||||
while (res = this.find(null, this.reverse, true))
|
||||
yield res;
|
||||
}
|
||||
finally {
|
||||
@@ -510,7 +510,7 @@ const RangeFind = Class("RangeFind", {
|
||||
return null;
|
||||
},
|
||||
|
||||
search: function (word, reverse, private_) {
|
||||
find: function (word, reverse, private_) {
|
||||
if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange))
|
||||
this.reset();
|
||||
|
||||
|
||||
@@ -352,7 +352,6 @@
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><pref>dom.popup_allowed_events</pref></li>
|
||||
<li><pref>accessibility.typeaheadfind</pref></li>
|
||||
</ul>
|
||||
|
||||
@@ -906,31 +905,31 @@
|
||||
<default>500</default>
|
||||
<description>
|
||||
<p>
|
||||
Maximum number of Ex commands and search patterns to store in the
|
||||
Maximum number of Ex commands and find patterns to store in the
|
||||
<t>command-line</t> history.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>'nohls' 'nohlsearch'</tags>
|
||||
<tags>'hls' 'hlsearch'</tags>
|
||||
<spec>'hlsearch' 'hls'</spec>
|
||||
<tags>'nohls' 'nohlfind'</tags>
|
||||
<tags>'hls' 'hlfind'</tags>
|
||||
<spec>'hlfind' 'hls'</spec>
|
||||
<type>boolean</type>
|
||||
<default>off</default>
|
||||
<description>
|
||||
<p>Highlight previous search pattern matches.</p>
|
||||
<p>Highlight previous find pattern matches.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>'nois' 'noincsearch'</tags>
|
||||
<tags>'is' 'incsearch'</tags>
|
||||
<spec>'incsearch' 'is'</spec>
|
||||
<tags>'nois' 'noincfind'</tags>
|
||||
<tags>'is' 'incfind'</tags>
|
||||
<spec>'incfind' 'is'</spec>
|
||||
<type>boolean</type>
|
||||
<default>on</default>
|
||||
<description>
|
||||
<p>Show the first match for a search pattern as it is typed.</p>
|
||||
<p>Show the first match for a find pattern as it is typed.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
xmlns="&xmlns.dactyl;"
|
||||
xmlns:html="&xmlns.html;">
|
||||
|
||||
<h1 tag="text-search-commands">Text search commands</h1>
|
||||
<h1 tag="text-find-commands">Text find commands</h1>
|
||||
<toc start="2"/>
|
||||
|
||||
<p>
|
||||
&dactyl.appName; provides a Vim-like incremental search interface to
|
||||
&dactyl.appName; provides a Vim-like incremental find interface to
|
||||
replace &dactyl.host;'s crippled Typeahead Find. Among other improvements,
|
||||
our search service:
|
||||
our find service:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
@@ -31,34 +31,34 @@
|
||||
unlike &dactyl.host;, which will always continue from the last match.
|
||||
</li>
|
||||
<li>
|
||||
Supports reverse incremental search.
|
||||
Supports reverse incremental find.
|
||||
</li>
|
||||
<li>
|
||||
Escape sequences to toggle link-only and case-sensitive searching.
|
||||
Escape sequences to toggle link-only and case-sensitive find.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Regular expression search, however, is not currently available unless the
|
||||
Regular expression find, however, is not currently available unless the
|
||||
/Find Bar/ service is installed, in which case it may be toggled on with
|
||||
a search flag.
|
||||
a find flag.
|
||||
</p>
|
||||
|
||||
<item>
|
||||
<tags>/</tags>
|
||||
<spec>/<a>pattern</a><oa>/</oa><k name="CR"/></spec>
|
||||
<description>
|
||||
<p>Search forward for the first occurrence of <a>pattern</a>.</p>
|
||||
<p>Find <a>pattern</a> starting at the current caret position.</p>
|
||||
|
||||
<p>
|
||||
The following escape sequences can be used to modify the
|
||||
behavior of the search. When flags conflict, the last to
|
||||
behavior of the find. When flags conflict, the last to
|
||||
appear is the one that takes effect.
|
||||
</p>
|
||||
|
||||
<dl dt="width: 6em;">
|
||||
<dt>\c</dt> <dd>Perform case insensitive search (default if <o>searchcase</o>=<str>ignore</str>).</dd>
|
||||
<dt>\C</dt> <dd>Perform case sensitive search (default if <o>searchcase</o>=<str>match</str>).</dd>
|
||||
<dt>\c</dt> <dd>Perform case insensitive find (default if <o>findcase</o>=<str>ignore</str>).</dd>
|
||||
<dt>\C</dt> <dd>Perform case sensitive find (default if <o>findcase</o>=<str>match</str>).</dd>
|
||||
<dt>\l</dt> <dd>Search only in links, as defined by <o>hinttags</o>.</dd>
|
||||
<dt>\L</dt> <dd>Search the entire page.</dd>
|
||||
</dl>
|
||||
@@ -78,7 +78,10 @@
|
||||
<tags>?</tags>
|
||||
<spec>?<a>pattern</a><oa>?</oa><k name="CR"/></spec>
|
||||
<description>
|
||||
<p>Search backward for <a>pattern</a>, in exactly the same manner as <k>/</k>.</p>
|
||||
<p>
|
||||
Find a pattern backward of the current caret position in exactly the
|
||||
same manner as <k>/</k>
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -86,7 +89,7 @@
|
||||
<tags>n</tags>
|
||||
<spec>n</spec>
|
||||
<description short="true">
|
||||
<p>Find next. Repeat the last search.</p>
|
||||
<p>Find next. Repeat the last find.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -94,7 +97,7 @@
|
||||
<tags>N</tags>
|
||||
<spec>N</spec>
|
||||
<description short="true">
|
||||
<p>Find previous. Repeat the last search in the opposite direction.</p>
|
||||
<p>Find previous. Repeat the last find in the opposite direction.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -115,13 +118,13 @@
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:noh :nohlsearch</tags>
|
||||
<tags>:noh :nohlfind</tags>
|
||||
<strut/>
|
||||
<spec>:noh<oa>lsearch</oa></spec>
|
||||
<spec>:noh<oa>lfind</oa></spec>
|
||||
<description>
|
||||
<p>
|
||||
Remove the search highlighting. The document is highlighted again
|
||||
when another search command is used or the <o>hlsearch</o> option
|
||||
Remove the find highlighting. The document is highlighted again
|
||||
when another find command is used or the <o>hlfind</o> option
|
||||
is set.
|
||||
</p>
|
||||
</description>
|
||||
|
||||
@@ -49,29 +49,31 @@
|
||||
* The concept of completion contexts is now exposed to the user
|
||||
(see :h :contexts), allowing for powerful and fine-grained
|
||||
completion system customization.
|
||||
* IMPORTANT: 'linksearch' has been removed. The \l search modifier can
|
||||
still be used for this purpose.
|
||||
* IMPORTANT: 'laststatus' has been replaced with the "s" flag in
|
||||
'guioptions'.
|
||||
* IMPORTANT: 'showstatuslinks' is now a string option.
|
||||
* IMPORTANT: 'ignorecase' and 'smartcase' have been replaced with 'searchcase'
|
||||
* IMPORTANT option changes:
|
||||
- 'cdpath' and 'runtimepath' no longer treat ",,"
|
||||
specially. Use "." instead.
|
||||
- 'incsearch', 'hlsearch', 'ignorecase', and 'smartcase' have
|
||||
been replaced with 'incfind', 'hlfind', and 'findcase'
|
||||
- 'extendedhinttags' is now a regexpmap rather than a
|
||||
string.
|
||||
- 'guioptions' default value has changed.
|
||||
- 'laststatus' has been replaced with the "s" flag in
|
||||
'guioptions'.
|
||||
- 'linksearch' has been removed. The \l search modifier can
|
||||
still be used for this purpose.
|
||||
- 'loadplugins' is now a regexplist option rather than
|
||||
a boolean.
|
||||
- 'mapleader' is now an option rather than a :let
|
||||
variable.
|
||||
- 'showstatuslinks' is now a string option.
|
||||
* IMPORTANT: Command script files now use the *.penta file extension.
|
||||
* IMPORTANT: Plugins are now loaded from the 'plugins/'
|
||||
directory in 'runtimepath' rather than 'plugin/'.
|
||||
* IMPORTANT: 'loadplugins' is now a regexplist option rather than
|
||||
a boolean.
|
||||
* IMPORTANT: 'cdpath' and 'runtimepath' no longer treat ",,"
|
||||
specially. Use "." instead.
|
||||
* IMPORTANT: Option value quoting has changed. List options will
|
||||
no longer be split at quoted commas and the option name,
|
||||
operators, and = sign may no longer be quoted. This will break
|
||||
certain automatically-generated configuration files.
|
||||
See :help stringlist
|
||||
* IMPORTANT: 'extendedhinttags' is now a regexpmap rather than a
|
||||
string.
|
||||
* IMPORTANT: 'guioptions' default value has changed.
|
||||
* IMPORTANT: 'mapleader' is now an option rather than a :let
|
||||
variable.
|
||||
* Added "bookmarks", "diverted", and "links" to 'activate'
|
||||
option.
|
||||
* Added 'altwildmode' and <A-Tab> command-line key binding.
|
||||
|
||||
Reference in New Issue
Block a user