mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 14:02:28 +01:00
add note to buffer.getCurrentWord regarding Firefox's getSelection() bug
This commit is contained in:
@@ -1272,21 +1272,23 @@ function Buffer() //{{{
|
|||||||
},
|
},
|
||||||
|
|
||||||
// in contrast to vim, returns the selection if one is made,
|
// in contrast to vim, returns the selection if one is made,
|
||||||
// otherwise tries to guess the current word unter the text cursor
|
// otherwise tries to guess the current word under the text cursor
|
||||||
// NOTE: might change the selection
|
// NOTE: might change the selection
|
||||||
|
// FIXME: getSelection() doesn't always preserve line endings, see:
|
||||||
|
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303
|
||||||
getCurrentWord: function ()
|
getCurrentWord: function ()
|
||||||
{
|
{
|
||||||
var selection = window.content.getSelection().toString();
|
let selection = window.content.getSelection().toString();
|
||||||
|
|
||||||
if (!selection)
|
if (!selection)
|
||||||
{
|
{
|
||||||
let selController = this.selectionController;
|
let controller = this.selectionController;
|
||||||
let caretmode = selController.getCaretEnabled();
|
let caretmode = controller.getCaretEnabled();
|
||||||
selController.setCaretEnabled(true);
|
controller.setCaretEnabled(true);
|
||||||
selController.wordMove(false, false);
|
controller.wordMove(false, false);
|
||||||
selController.wordMove(true, true);
|
controller.wordMove(true, true);
|
||||||
selection = window.content.getSelection().toString();
|
selection = window.content.getSelection().toString();
|
||||||
selController.setCaretEnabled(caretmode);
|
controller.setCaretEnabled(caretmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return selection;
|
return selection;
|
||||||
|
|||||||
Reference in New Issue
Block a user