mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-04 23:13:33 +02:00
add 'hlsearch' option
This commit is contained in:
@@ -28,13 +28,12 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
|
|
||||||
|
|
||||||
// make sure you only create this object when the "vimperator" object is ready
|
// make sure you only create this object when the "vimperator" object is ready
|
||||||
// vimperator.search = new function()
|
|
||||||
function Search() //{{{
|
function Search() //{{{
|
||||||
{
|
{
|
||||||
var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
|
var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
|
||||||
var found = false; // true if the last search was successful
|
var found = false; // true if the last search was successful
|
||||||
var backwards = false;
|
var backwards = false;
|
||||||
var lastsearch = ""; // keep track of the last searched string
|
var lastsearch = ""; // keep track of the last searched string
|
||||||
var lastsearch_backwards = false; // like "backwards", but for the last search, so if you cancel a search with <esc> this is not set
|
var lastsearch_backwards = false; // like "backwards", but for the last search, so if you cancel a search with <esc> this is not set
|
||||||
|
|
||||||
// Event handlers for search - closure is needed
|
// Event handlers for search - closure is needed
|
||||||
@@ -145,6 +144,12 @@ function Search() //{{{
|
|||||||
vimperator.focusContent();
|
vimperator.focusContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.highlight = function()
|
||||||
|
{
|
||||||
|
if (lastsearch)
|
||||||
|
gFindBar._highlightDoc("yellow", "black", lastsearch);
|
||||||
|
}
|
||||||
|
|
||||||
this.clear = function()
|
this.clear = function()
|
||||||
{
|
{
|
||||||
gFindBar._highlightDoc();
|
gFindBar._highlightDoc();
|
||||||
|
|||||||
@@ -425,6 +425,13 @@ function Options() //{{{
|
|||||||
default_value: DEFAULT_HINTTAGS
|
default_value: DEFAULT_HINTTAGS
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
addOption(new Option(["hlsearch", "hls"], "boolean",
|
||||||
|
{
|
||||||
|
short_help: "Highlight previous search pattern matches",
|
||||||
|
setter: function(value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); },
|
||||||
|
default_value: false
|
||||||
|
}
|
||||||
|
));
|
||||||
addOption(new Option(["maxhints", "mh"], "number",
|
addOption(new Option(["maxhints", "mh"], "number",
|
||||||
{
|
{
|
||||||
short_help: "Maximum number of simultaneously shown hints",
|
short_help: "Maximum number of simultaneously shown hints",
|
||||||
|
|||||||
Reference in New Issue
Block a user