Created
April 20, 2009 03:46
-
-
Save satyr/98350 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ubiquity/chrome/content/ubiquity.js b/ubiquity/chrome/content/ubiquity.js | |
--- a/ubiquity/chrome/content/ubiquity.js | |
+++ b/ubiquity/chrome/content/ubiquity.js | |
@@ -92,16 +92,20 @@ Ubiquity.prototype = { | |
__KEYCODE_DOWN: 40, | |
__KEYCODE_TAB: 9, | |
__MIN_CMD_PREVIEW_LENGTH: 0, | |
__KEYCODE_1: 49, | |
get textBox() { | |
return this.__textBox; | |
}, | |
+ | |
+ get lastKeyEvent() { | |
+ return this.__lastKeyEvent; | |
+ }, | |
__onBlur: function __onBlur() { | |
// Hackish fix for #330. | |
var self = this; | |
function refocusTextbox() { | |
if (self.__showCount) { | |
var isTextBoxFocused = (document.commandDispatcher.focusedElement == | |
@@ -115,16 +119,18 @@ Ubiquity.prototype = { | |
}, | |
__onMouseMove: function __onMouseMove(event) { | |
this.__x = event.screenX; | |
this.__y = event.screenY; | |
}, | |
__onKeydown: function __onKeyDown(event) { | |
+ this.__lastKeyEvent = event; | |
+ | |
if (event.keyCode == this.__KEYCODE_UP) { | |
event.preventDefault(); | |
this.__cmdManager.moveIndicationUp(this.__makeContext()); | |
} else if (event.keyCode == this.__KEYCODE_DOWN) { | |
event.preventDefault(); | |
this.__cmdManager.moveIndicationDown(this.__makeContext()); | |
} else if (event.keyCode == this.__KEYCODE_TAB) { | |
event.preventDefault(); | |
@@ -132,16 +138,18 @@ Ubiquity.prototype = { | |
this.__makeContext() | |
); | |
if(suggestionText) | |
this.__textBox.value = suggestionText; | |
} | |
}, | |
__onInput: function __onInput(event) { | |
+ this.__lastKeyEvent = event; | |
+ | |
if (this.__showCount == 0) | |
return; | |
var keyCode = event.keyCode; | |
if (keyCode == this.__KEYCODE_UP || | |
keyCode == this.__KEYCODE_DOWN || | |
keyCode == this.__KEYCODE_TAB) { | |
diff --git a/ubiquity/modules/utils.js b/ubiquity/modules/utils.js | |
--- a/ubiquity/modules/utils.js | |
+++ b/ubiquity/modules/utils.js | |
@@ -321,18 +321,21 @@ Utils.openUrlInBrowser = function openUr | |
//2 (default in SeaMonkey and Firefox 1.5): In a new window | |
//3 (default in Firefox 2 and above): In a new tab | |
//1 (or anything else): In the current tab or window | |
if(browser.mCurrentBrowser.currentURI.spec == "about:blank" && | |
!browser.webProgress.isLoadingDocument ) | |
browserWindow.loadURI(urlString, null, postInputStream, false); | |
- else if(openPref == 3) | |
- browser.loadOneTab(urlString, null, null, postInputStream, false, false); | |
+ else if(openPref == 3){ | |
+ var ub = Utils.currentChromeWindow.gUbiquity, ke = ub && ub.lastKeyEvent; | |
+ browser[ke && ke.ctrlKey ? 'addTab' : 'loadOneTab']( | |
+ urlString, null, null, postInputStream, false, false); | |
+ } | |
else if(openPref == 2) | |
browserWindow.openDialog('chrome://browser/content', '_blank', | |
'all,dialog=no', urlString, null, null, | |
postInputStream); | |
else | |
browserWindow.loadURI(urlString, null, postInputStream, false); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment