pressing ctrl+home second time should restore selection
This commit is contained in:
parent
ec8b42c5e0
commit
52e0b2d163
2 changed files with 25 additions and 5 deletions
|
|
@ -118,13 +118,15 @@ exports.commands = [{
|
||||||
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
||||||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||||
multiSelectAction: "forEach",
|
multiSelectAction: "forEach",
|
||||||
readOnly: true
|
readOnly: true,
|
||||||
|
group: "fileJump"
|
||||||
}, {
|
}, {
|
||||||
name: "gotostart",
|
name: "gotostart",
|
||||||
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
||||||
exec: function(editor) { editor.navigateFileStart(); },
|
exec: function(editor) { editor.navigateFileStart(); },
|
||||||
multiSelectAction: "forEach",
|
multiSelectAction: "forEach",
|
||||||
readOnly: true
|
readOnly: true,
|
||||||
|
group: "fileJump"
|
||||||
}, {
|
}, {
|
||||||
name: "selectup",
|
name: "selectup",
|
||||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||||
|
|
@ -142,13 +144,15 @@ exports.commands = [{
|
||||||
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
|
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
|
||||||
exec: function(editor) { editor.getSelection().selectFileEnd(); },
|
exec: function(editor) { editor.getSelection().selectFileEnd(); },
|
||||||
multiSelectAction: "forEach",
|
multiSelectAction: "forEach",
|
||||||
readOnly: true
|
readOnly: true,
|
||||||
|
group: "fileJump"
|
||||||
}, {
|
}, {
|
||||||
name: "gotoend",
|
name: "gotoend",
|
||||||
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
|
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
|
||||||
exec: function(editor) { editor.navigateFileEnd(); },
|
exec: function(editor) { editor.navigateFileEnd(); },
|
||||||
multiSelectAction: "forEach",
|
multiSelectAction: "forEach",
|
||||||
readOnly: true
|
readOnly: true,
|
||||||
|
group: "fileJump"
|
||||||
}, {
|
}, {
|
||||||
name: "selectdown",
|
name: "selectdown",
|
||||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,27 @@ var Editor = function(renderer, session) {
|
||||||
this.commands.on("exec", function(e) {
|
this.commands.on("exec", function(e) {
|
||||||
this.startOperation(e);
|
this.startOperation(e);
|
||||||
|
|
||||||
|
var command = e.command;
|
||||||
|
if (command.group == "fileJump") {
|
||||||
|
var prev = this.prevOp;
|
||||||
|
if (!prev || prev.command.group != "fileJump") {
|
||||||
|
this.lastFileJumpPos = last(this.selections)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.lastFileJumpPos = null;
|
||||||
|
}
|
||||||
}.bind(this), true);
|
}.bind(this), true);
|
||||||
|
|
||||||
this.commands.on("afterExec", function(e) {
|
this.commands.on("afterExec", function(e) {
|
||||||
this.endOperation(e);
|
var command = e.command;
|
||||||
|
|
||||||
|
if (command.group == "fileJump") {
|
||||||
|
if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
|
||||||
|
this.selection.fromJSON(this.lastFileJumpPos);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.endOperation(e);
|
||||||
}.bind(this), true);
|
}.bind(this), true);
|
||||||
|
|
||||||
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
|
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue