1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 08:37:59 +01:00

Revert 975d3f90c8a1 for now.

The magical powers of getCurrentWord() have temporarily won.
This commit is contained in:
Doug Kearns
2010-09-23 20:21:11 +10:00
parent ad8b0de148
commit 06215e2eb9
3 changed files with 6 additions and 8 deletions

View File

@@ -440,7 +440,7 @@ const Buffer = Module("buffer", {
},
/**
* Returns the current selection. If the selection is
* Returns the currently selected word. If the selection is
* null, it tries to guess the word that the caret is
* positioned in.
*
@@ -450,9 +450,7 @@ const Buffer = Module("buffer", {
*/
// FIXME: getSelection() doesn't always preserve line endings, see:
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303
// FIXME: The ABRACADABRA nature of this function has always seemed bizarre
// to me. Who's with me? --djk
get currentWord() {
getCurrentWord: function () {
let win = tabs.localStore.focusedFrame || content;
let selection = win.getSelection();
if (selection.rangeCount == 0)
@@ -1570,7 +1568,7 @@ const Buffer = Module("buffer", {
mappings.add(myModes, ["Y"],
"Copy selected text or current word",
function () {
let sel = buffer.currentWord;
let sel = buffer.getCurrentWord();
dactyl.assert(sel);
dactyl.clipboardWrite(sel, true);
});

View File

@@ -664,7 +664,7 @@ const Editor = Module("editor", {
modes.set(modes.TEXTAREA);
}
else
dactyl.clipboardWrite(buffer.currentWord, true);
dactyl.clipboardWrite(buffer.getCurrentWord(), true);
});
mappings.add([modes.VISUAL, modes.TEXTAREA],

View File

@@ -195,14 +195,14 @@ const RangeFinder = Module("rangefinder", {
"Find word under cursor",
function () {
rangefinder._found = false;
rangefinder.onSubmit(buffer.currentWord, false);
rangefinder.onSubmit(buffer.getCurrentWord(), false);
});
mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["#"],
"Find word under cursor backwards",
function () {
rangefinder._found = false;
rangefinder.onSubmit(buffer.currentWord, true);
rangefinder.onSubmit(buffer.getCurrentWord(), true);
});
},