diff options
Diffstat (limited to 'common/content/editor.js')
-rw-r--r-- | common/content/editor.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/common/content/editor.js b/common/content/editor.js index 87274cee..6a28e3c4 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -457,7 +457,7 @@ var Editor = Module("editor", { while (idx == 0 && (node = iterator.getPrev())) { let str = node.textContent; if (node == iterator.start) - idx = range.endOffset; + idx = range.startOffset; else idx = str.length; @@ -906,6 +906,19 @@ var Editor = Module("editor", { modes.push(modes.INSERT); }); + mappings.add([modes.VISUAL], + ["o"], "Focus the other end of the selection", + function () { + if (editor.isTextEdit) + var selection = editor.selection; + else + selection = buffer.focusedFrame.getSelection(); + util.assert(selection.focusOffset); + let { focusOffset, anchorOffset, focusNode, anchorNode } = selection; + selection.collapse(focusNode, focusOffset); + selection.extend(anchorNode, anchorOffset); + }); + bind(["p"], "Paste clipboard contents", function ({ count }) { dactyl.assert(!editor.isCaret); |