emacs: C-u C-x C-x fix (exchangePointAndMark)
This commit is contained in:
parent
e3ea71bb12
commit
0ea9428cd8
1 changed files with 11 additions and 3 deletions
|
|
@ -458,17 +458,25 @@ exports.handler.addCommands({
|
|||
multiSelectAction: "forEach"
|
||||
},
|
||||
exchangePointAndMark: {
|
||||
exec: function(editor) {
|
||||
exec: function(editor, args) {
|
||||
var sel = editor.selection;
|
||||
if (args.count) {
|
||||
var pos = editor.getCursorPosition();
|
||||
sel.clearSelection();
|
||||
sel.moveCursorToPosition(editor.popEmacsMark());
|
||||
editor.pushEmacsMark(pos);
|
||||
return;
|
||||
}
|
||||
var lastMark = editor.getLastEmacsMark();
|
||||
var range = sel.getRange();
|
||||
if (range.isEmpty()) {
|
||||
var lastMark = editor.getLastEmacsMark();
|
||||
sel.selectToPosition(lastMark);
|
||||
return;
|
||||
}
|
||||
editor.selection.setSelectionRange(range, !editor.selection.isBackwards());
|
||||
sel.setSelectionRange(range, !sel.isBackwards());
|
||||
},
|
||||
readonly: true,
|
||||
handlesCount: true,
|
||||
multiSelectAction: "forEach"
|
||||
},
|
||||
killWord: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue