mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 05:07:59 +01:00
* and # support
This commit is contained in:
1
Donators
1
Donators
@@ -13,6 +13,7 @@
|
||||
* Nigel McNie
|
||||
* Paulo Tanimoto
|
||||
* Nathan Saper
|
||||
* Albert Menkveld
|
||||
|
||||
I want to say a big <b>THANK YOU</b> for all people which supported this project in this way.
|
||||
</pre>
|
||||
|
||||
5
NEWS
5
NEWS
@@ -1,8 +1,9 @@
|
||||
<pre>
|
||||
2007-xx-xx:
|
||||
* version 0.6
|
||||
* <Esc> finally clears any selection made in the document
|
||||
* initial start of caret mode. Start with 'i', stop with <Esc>
|
||||
* support for * and # mappings to search for the text selection or the text under the cursor
|
||||
* Escape finally clears any selection made in the document
|
||||
* initial start of caret mode. Start with 'i', stop with Escape;
|
||||
* vimperator trys to stay in command mode after loading pages instead of having a text field focused
|
||||
* added a visual bell and replaced 'beep' with 'visualbell'
|
||||
* added vimperator logo (can be seen in the addons manager)
|
||||
|
||||
@@ -440,6 +440,7 @@ function Events() //{{{
|
||||
}
|
||||
}
|
||||
return false;
|
||||
//vimperator.setMode(vimperator.modes.CARET); // FOR TESTING ONLY
|
||||
}
|
||||
|
||||
// handle Escape-one-key mode (Ctrl-v)
|
||||
|
||||
@@ -108,10 +108,10 @@ function Search() //{{{
|
||||
this.find = function(str, backwards)
|
||||
{
|
||||
var fastFind = getBrowser().fastFind;
|
||||
str = processPattern(str);
|
||||
|
||||
fastFind.caseSensitive = case_sensitive;
|
||||
found = fastFind.find(str, false) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -158,15 +158,17 @@ function Search() //{{{
|
||||
if (!vimperator.options["incsearch"])
|
||||
return;
|
||||
|
||||
command = processPattern(command);
|
||||
this.find(command, backwards);
|
||||
}
|
||||
|
||||
// Called when the enter key is pressed to trigger a search
|
||||
this.searchSubmitted = function(command)
|
||||
// use forced_direction if you call this function directly
|
||||
this.searchSubmitted = function(command, forced_backward)
|
||||
{
|
||||
if (typeof forced_backward === "boolean")
|
||||
backwards = forced_backward;
|
||||
|
||||
this.clear();
|
||||
command = processPattern(command);
|
||||
this.find(command, backwards);
|
||||
this.highlight(command);
|
||||
|
||||
|
||||
@@ -1377,6 +1377,41 @@ function Mappings() //{{{
|
||||
{ }
|
||||
));
|
||||
|
||||
|
||||
// BIG FIXME: unify event handling to allow keys to be valid in more than one mode!!
|
||||
addDefaultMap(new Map(vimperator.modes.CARET, ["*"],
|
||||
function(count)
|
||||
{
|
||||
vimperator.search.searchSubmitted(vimperator.getCurrentWord(), false);
|
||||
vimperator.search.findAgain();
|
||||
},
|
||||
{ }
|
||||
));
|
||||
addDefaultMap(new Map(vimperator.modes.NORMAL, ["*"],
|
||||
function(count)
|
||||
{
|
||||
vimperator.search.searchSubmitted(vimperator.getCurrentWord(), false);
|
||||
vimperator.search.findAgain();
|
||||
},
|
||||
{ }
|
||||
));
|
||||
addDefaultMap(new Map(vimperator.modes.CARET, ["#"],
|
||||
function(count)
|
||||
{
|
||||
vimperator.search.searchSubmitted(vimperator.getCurrentWord(), true);
|
||||
vimperator.search.findAgain();
|
||||
},
|
||||
{ }
|
||||
));
|
||||
addDefaultMap(new Map(vimperator.modes.NORMAL, ["#"],
|
||||
function(count)
|
||||
{
|
||||
vimperator.search.searchSubmitted(vimperator.getCurrentWord(), true);
|
||||
vimperator.search.findAgain();
|
||||
},
|
||||
{ }
|
||||
));
|
||||
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -354,6 +354,28 @@ const vimperator = (function() //{{{
|
||||
return new LocalFile(path, mode, perms, tmp);
|
||||
},
|
||||
|
||||
|
||||
// in contrast to vim, returns the selection if one is made,
|
||||
// otherwise tries to guess the current word unter the text cursor
|
||||
// NOTE: might change the selection
|
||||
getCurrentWord: function()
|
||||
{
|
||||
var selection = window.content.getSelection().toString();
|
||||
if (!selection)
|
||||
{
|
||||
var selection_controller = getBrowser().docShell
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsISelectionDisplay)
|
||||
.QueryInterface(Components.interfaces.nsISelectionController);
|
||||
|
||||
selection_controller.setCaretEnabled(true);
|
||||
selection_controller.wordMove(false, false);
|
||||
selection_controller.wordMove(true, true);
|
||||
selection = window.content.getSelection().toString();
|
||||
}
|
||||
return selection;
|
||||
},
|
||||
|
||||
// logs a message to the javascript error console
|
||||
log: function(msg, level)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user