diff --git a/app/editors.js b/app/editors.js index 90bafe1..f1adde7 100644 --- a/app/editors.js +++ b/app/editors.js @@ -1095,7 +1095,8 @@ function applyPrefs(tab) { name: "appendLineSelection", exec: function (editor, args, request) { var string = args[0]; - + + editor.selection.selectLineEnd(); var text = editor.getSelectedText(); editor.insert(text.replace(new RegExp("\n", 'g'), string + "\n") + string, true); } @@ -1426,6 +1427,38 @@ function applyPrefs(tab) { multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true + }, { + name: "addSemicolon", + bindKey: { + win: preferences.getKeyBinding('addSemicolon'), + mac: preferences.getKeyBinding('addSemicolon', 'mac'), + sender: "editor" + }, + exec: function(editor) { editor.commands.exec('appendLineSelection', editor, [';']); }, + multiSelectAction: "forEach", + scrollIntoView: "center" + }, { + name: "jumpToMatching", + bindKey: { + win: preferences.getKeyBinding('jumpToMatching'), + mac: preferences.getKeyBinding('jumpToMatching', 'mac'), + sender: "editor" + }, + exec: function(editor) { editor.jumpToMatching(); }, + multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true + }, { + name: "selectToMatching", + bindKey: { + win: preferences.getKeyBinding('selectToMatching'), + mac: preferences.getKeyBinding('selectToMatching', 'mac'), + sender: "editor" + }, + exec: function(editor) { editor.jumpToMatching(true); }, + multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true }, { name: "tag-start", bindKey: { diff --git a/app/keybindings.js b/app/keybindings.js index f15af9f..c7bdaea 100644 --- a/app/keybindings.js +++ b/app/keybindings.js @@ -82,7 +82,26 @@ var actions = { label: lang.expandSelection, defaultKeyBinding: 'Alt-Shift-L' }, + 'addSemicolon': { + label: lang.addSemicolon, + defaultKeyBinding: '' + }, + 'jumpToMatching': { + label: lang.jumpToMatching, + defaultKeyBinding: 'Ctrl-P' + }, + 'selectToMatching': { + label: lang.selectToMatching, + defaultKeyBinding: 'Ctrl-Shift-P' + }, /* + 'preferences': { + label: lang.preferencesText, + defaultKeyBinding: 'Ctrl-U', + exec: function() { + preferences.open(); + } + }, 'newTab': { label: 'New Tab', defaultKeyBinding: 'Alt-N' diff --git a/app/menubar.js b/app/menubar.js index 53a89a6..77d2de9 100644 --- a/app/menubar.js +++ b/app/menubar.js @@ -144,7 +144,7 @@ function init () { target: 'site' }, { id: 'print', - text: makeMenuText(lang.print+'...', 'Ctrl-P'), + text: makeMenuText(lang.print + '...', 'Ctrl-P'), disabled: true, target: 'file', handler: function() { @@ -252,7 +252,7 @@ function init () { target: 'file' }, { id: 'jumpToMatching', - text: makeMenuText(lang.jumpToMatching, 'Ctrl-P'), + text: makeMenuText(lang.jumpToMatching, preferences.getKeyBinding('jumpToMatching'), 'jumpToMatching'), handler: function () { var tab = activeTab; var editor = tabs.getEditor(tab); @@ -263,7 +263,7 @@ function init () { target: 'file' }, { id: 'selectToMatching', - text: makeMenuText(lang.selectToMatching, 'Ctrl-Shift-P'), + text: makeMenuText(lang.selectToMatching, preferences.getKeyBinding('selectToMatching'), 'selectToMatching'), handler: function () { var tab = activeTab; var editor = tabs.getEditor(tab); @@ -324,7 +324,7 @@ function init () { target: 'file' }, '-', { id: 'addSemicolon', - text: makeMenuText(lang.addSemicolon, 'Ctrl-;'), + text: makeMenuText(lang.addSemicolon, preferences.getKeyBinding('addSemicolon'), 'addSemicolon'), handler: function () { var tab = activeTab; var editor = tabs.getEditor(tab); @@ -334,7 +334,7 @@ function init () { target: 'file' }, { id: 'applySourceFormatting', - text: makeMenuText(lang.beautify, 'Alt-Shift-F'), + text: makeMenuText(lang.beautify, preferences.getKeyBinding('applySourceFormatting'), 'applySourceFormatting'), handler: function () { var tab = activeTab; var editor = tabs.getEditor(tab);