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

add note to buffer.getCurrentWord regarding Firefox's getSelection() bug

This commit is contained in:
Doug Kearns
2008-10-31 08:22:05 +00:00
parent d498825baf
commit c3ce38db9c

View File

@@ -1272,21 +1272,23 @@ function Buffer() //{{{
},
// 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
// FIXME: getSelection() doesn't always preserve line endings, see:
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303
getCurrentWord: function ()
{
var selection = window.content.getSelection().toString();
let selection = window.content.getSelection().toString();
if (!selection)
{
let selController = this.selectionController;
let caretmode = selController.getCaretEnabled();
selController.setCaretEnabled(true);
selController.wordMove(false, false);
selController.wordMove(true, true);
let controller = this.selectionController;
let caretmode = controller.getCaretEnabled();
controller.setCaretEnabled(true);
controller.wordMove(false, false);
controller.wordMove(true, true);
selection = window.content.getSelection().toString();
selController.setCaretEnabled(caretmode);
controller.setCaretEnabled(caretmode);
}
return selection;