From 0029f7bd1647dad1532d9b8ead39585a4a96371c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 13 Oct 2011 15:39:18 -0400 Subject: [PATCH] Fallback to useable clipboard on Windows. Closes issue #690. --- common/content/dactyl.js | 4 +--- common/modules/buffer.jsm | 15 ++++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index edc5e14b..b9d95718 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -378,10 +378,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @optional */ clipboardWrite: function clipboardWrite(str, verbose, which) { - if (which == null) + if (which == null || which == "selection" && !services.clipboard.supportsSelectionClipboard()) services.clipboardHelper.copyString(str); - else if (which == "selection" && !services.clipboard.supportsSelectionClipboard()) - return; else services.clipboardHelper.copyStringToClipboard(str, services.clipboard["k" + util.capitalize(which) + "Clipboard"]); diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 1b7e6a60..90b5c976 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -1518,13 +1518,18 @@ var Buffer = Module("Buffer", { }, _exWidth: function _exWidth(elem) { - let div = DOM(, - elem.ownerDocument).appendTo(elem.body || elem); try { - return parseFloat(div.style.width); + let div = DOM(, + elem.ownerDocument).appendTo(elem.body || elem); + try { + return parseFloat(div.style.width); + } + finally { + div.remove(); + } } - finally { - div.remove(); + catch (e) { + return parseFloat(DOM(elem).fontSize) / 1.618; } },