mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
feature(edit) add go to line
This commit is contained in:
parent
6d5ee1f1d5
commit
a73bc6b16a
2 changed files with 22 additions and 2 deletions
1
HELP.md
1
HELP.md
|
|
@ -97,6 +97,7 @@ Edit
|
|||
###Hot keys
|
||||
- **F4** - open
|
||||
- **Ctrl + s** - save
|
||||
- **Ctrl + g** - go to line
|
||||
- **Esc** - close
|
||||
|
||||
For more details see [Ace keyboard shortcuts](https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts "Ace keyboard shortcuts").
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
Ace,
|
||||
Msg,
|
||||
Key = CloudCmd.Key,
|
||||
Dialog = DOM.Dialog,
|
||||
Images = DOM.Images,
|
||||
|
||||
Element;
|
||||
|
||||
function init() {
|
||||
|
|
@ -92,6 +90,19 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
CloudCmd.View.hide();
|
||||
};
|
||||
|
||||
this.goToLine = function() {
|
||||
var dialog = DOM.Dialog,
|
||||
msg = 'Line number:',
|
||||
cursor = Ace.selection.getCursor(),
|
||||
number = cursor.row + 1,
|
||||
line = dialog.prompt(msg, number);
|
||||
|
||||
number = line - 0;
|
||||
|
||||
if (number)
|
||||
Ace.gotoLine(number);
|
||||
};
|
||||
|
||||
function focus() {
|
||||
Ace.focus();
|
||||
Ace.clearSelection();
|
||||
|
|
@ -120,6 +131,14 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'goToLine',
|
||||
bindKey : { win: 'Ctrl-G', mac: 'Command-G' },
|
||||
exec : function () {
|
||||
Edit.goToLine();
|
||||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'save',
|
||||
bindKey : { win: 'Ctrl-S', mac: 'Command-S' },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue