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