1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 02:47:58 +01:00

* and # support

This commit is contained in:
Martin Stubenschrott
2007-09-06 17:39:21 +00:00
parent d9888288f3
commit 16bb541c98
6 changed files with 68 additions and 6 deletions

View File

@@ -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)
{