[Vimperator] shift-insertII.patch

calmar mac at calmar.ws
Mon Jul 9 16:52:17 PDT 2007


Hi all,

works now here.

shift-insert for the X-Clipboard. Ctrl-V/menu for the
firefox-Clipboard.

Cheers
marco


-- 
   (o_  It rocks: LINUX + Command-Line-Interface
   //\
   V_/_                     http://www.calmar.ws
-------------- next part --------------
Index: chrome/content/vimperator/vimperator.js
===================================================================
RCS file: /cvs/vimperator/src/chrome/content/vimperator/vimperator.js,v
retrieving revision 1.91
diff -u -r1.91 vimperator.js
--- chrome/content/vimperator/vimperator.js	8 Jul 2007 20:38:19 -0000	1.91
+++ chrome/content/vimperator/vimperator.js	9 Jul 2007 23:49:53 -0000
@@ -488,7 +488,9 @@
             {
                 var elt = window.document.commandDispatcher.focusedElement;
 
-                if(elt.setSelectionRange) // to check if it's a selection?
+                if(elt.setSelectionRange && readFromClipboard())
+                    // readFromClipboard would return 'undefined' if not checked
+                    // dunno about .setSelectionRange
                 {
                     var rangeStart = elt.selectionStart; // caret position
                     var rangeEnd = elt.selectionEnd;
@@ -498,9 +500,10 @@
                     elt.value = tempStr1 + tempStr2  + tempStr3;
                     elt.selectionStart = rangeStart + tempStr2.length;
                     elt.selectionEnd = elt.selectionStart;
+                    event.preventDefault();
+                    // prevents additional firefox-clipboard pasting
                 }
             }
-
             return false;
         }
 


More information about the Vimperator mailing list