diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 09f9f863..6e3b3200 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -1324,13 +1324,6 @@ function scrollBufferAbsolute(horizontal, vertical) // misc helper functions /////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{ -function copyToClipboard(str) -{ - var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] - .getService(Components.interfaces.nsIClipboardHelper); - clipboardHelper.copyString(str); -} - // returns an XPathResult object function evaluateXPath(expression, doc, ordered) { diff --git a/chrome/content/vimperator/hints.js b/chrome/content/vimperator/hints.js index af2b85b8..f581cda7 100644 --- a/chrome/content/vimperator/hints.js +++ b/chrome/content/vimperator/hints.js @@ -517,7 +517,7 @@ function Hints() //{{{ // disable the hints before we can echo() an information this.disableHahMode(null, true); - copyToClipboard(loc); + vimperator.copyToClipboard(loc); vimperator.echo("Yanked " + loc); }; @@ -540,7 +540,7 @@ function Hints() //{{{ // disable the hints before we can echo() an information this.disableHahMode(null, true); - copyToClipboard(loc); + vimperator.copyToClipboard(loc); vimperator.echo("Yanked " + loc); }; diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index 19d4160b..0e1724a8 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -539,7 +539,7 @@ function Mappings() //{{{ function() { var loc = getCurrentLocation(); - copyToClipboard(loc); + vimperator.copyToClipboard(loc); vimperator.echo("Yanked " + loc); }, { @@ -551,7 +551,7 @@ function Mappings() //{{{ function() { var sel = window.content.document.getSelection(); - copyToClipboard(sel); + vimperator.copyToClipboard(sel); vimperator.echo("Yanked " + sel); }, { diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index fededf89..885abf71 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -207,6 +207,13 @@ const vimperator = (function() //{{{ sound_service.beep(); }, + copyToClipboard: function(str) + { + var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] + .getService(Components.interfaces.nsIClipboardHelper); + clipboardHelper.copyString(str); + }, + execute: function(string, modifiers) { // skip comments and blank lines