Merge pull request #2155 from ajaxorg/keyboard/emacs

fix #2154 Emacs copy/paste issue with highlighting marker
This commit is contained in:
Ruben Daniels 2014-09-17 15:20:12 +02:00
commit 0989419251

View file

@ -300,9 +300,12 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (!command) return undefined; if (!command) return undefined;
} }
if (!command.readonly && !command.isYank) if (!command.readOnly && !command.isYank)
data.lastCommand = null; data.lastCommand = null;
if (!command.readOnly && editor.emacsMark())
editor.setEmacsMark(null)
if (data.count) { if (data.count) {
var count = data.count; var count = data.count;
data.count = 0; data.count = 0;
@ -384,7 +387,7 @@ exports.emacsKeys = {
"M-y": "yankRotate", "M-y": "yankRotate",
"C-g": "keyboardQuit", "C-g": "keyboardQuit",
"C-w": "killRegion", "C-w|C-S-W": "killRegion",
"M-w": "killRingSave", "M-w": "killRingSave",
"C-Space": "setMark", "C-Space": "setMark",
"C-x C-x": "exchangePointAndMark", "C-x C-x": "exchangePointAndMark",
@ -466,7 +469,7 @@ exports.handler.addCommands({
editor.setEmacsMark(mark); editor.setEmacsMark(mark);
editor.selection.setSelectionAnchor(mark.row, mark.column); editor.selection.setSelectionAnchor(mark.row, mark.column);
}, },
readonly: true, readOnly: true,
handlesCount: true, handlesCount: true,
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, },
@ -488,7 +491,7 @@ exports.handler.addCommands({
} }
sel.setSelectionRange(range, !sel.isBackwards()); sel.setSelectionRange(range, !sel.isBackwards());
}, },
readonly: true, readOnly: true,
handlesCount: true, handlesCount: true,
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, },
@ -547,7 +550,7 @@ exports.handler.addCommands({
exports.killRing.add(editor.getCopyText()); exports.killRing.add(editor.getCopyText());
editor.commands.byName.cut.exec(editor); editor.commands.byName.cut.exec(editor);
}, },
readonly: true, readOnly: true,
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, },
killRingSave: { killRingSave: {
@ -560,7 +563,7 @@ exports.handler.addCommands({
sel.clearSelection(); sel.clearSelection();
}, 0); }, 0);
}, },
readonly: true readOnly: true
}, },
keyboardQuit: function(editor) { keyboardQuit: function(editor) {
editor.selection.clearSelection(); editor.selection.clearSelection();