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

Fix ticket #6

This commit is contained in:
Kris Maglione
2008-10-31 16:01:39 +00:00
parent e412a11d77
commit f7141d55e1

View File

@@ -1278,20 +1278,17 @@ function Buffer() //{{{
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303
getCurrentWord: function ()
{
let selection = window.content.getSelection().toString();
if (!selection)
var selection = window.content.getSelection();
if (selection.isCollapsed)
{
let controller = this.selectionController;
let caretmode = controller.getCaretEnabled();
controller.setCaretEnabled(true);
controller.wordMove(false, false);
controller.wordMove(true, true);
selection = window.content.getSelection().toString();
controller.setCaretEnabled(caretmode);
let selController = this.selectionController;
let caretmode = selController.getCaretEnabled();
selController.setCaretEnabled(true);
selController.wordMove(false, false);
selController.wordMove(true, true);
selController.setCaretEnabled(caretmode);
}
return selection;
return String(selection.getRangeAt(0));
},
// more advanced than a simple elem.focus() as it also works for iframes