diff --git a/src/command/Commands.js b/src/command/Commands.js index 90fbdbafbfe..79c66c295b4 100644 --- a/src/command/Commands.js +++ b/src/command/Commands.js @@ -54,6 +54,7 @@ define(function (require, exports, module) { exports.EDIT_COPY = "edit.copy"; exports.EDIT_PASTE = "edit.paste"; exports.EDIT_SELECT_ALL = "edit.selectAll"; + exports.EDIT_SELECT_LINE = "edit.selectLine"; exports.EDIT_FIND = "edit.find"; exports.EDIT_FIND_IN_FILES = "edit.findInFiles"; exports.EDIT_FIND_NEXT = "edit.findNext"; diff --git a/src/command/Menus.js b/src/command/Menus.js index 59c4cf3a2b9..5881785174c 100644 --- a/src/command/Menus.js +++ b/src/command/Menus.js @@ -866,6 +866,8 @@ define(function (require, exports, module) { */ menu = addMenu(Strings.EDIT_MENU, AppMenuBar.EDIT_MENU); menu.addMenuItem(Commands.EDIT_SELECT_ALL, "Ctrl-A"); + menu.addMenuItem(Commands.EDIT_SELECT_LINE, [{key: "Ctrl-L", platform: "win"}, + {key: "Ctrl-L", platform: "mac"}]); menu.addMenuDivider(); menu.addMenuItem(Commands.EDIT_FIND, "Ctrl-F"); menu.addMenuItem(Commands.EDIT_FIND_IN_FILES, "Ctrl-Shift-F"); diff --git a/src/editor/EditorCommandHandlers.js b/src/editor/EditorCommandHandlers.js index 45ed76d2387..85b6811bc0b 100644 --- a/src/editor/EditorCommandHandlers.js +++ b/src/editor/EditorCommandHandlers.js @@ -35,8 +35,7 @@ define(function (require, exports, module) { var Commands = require("command/Commands"), Strings = require("strings"), CommandManager = require("command/CommandManager"), - EditorManager = require("editor/EditorManager"), - Editor = require("editor/Editor").Editor; + EditorManager = require("editor/EditorManager"); /** @@ -295,6 +294,16 @@ define(function (require, exports, module) { editor._codeMirror.execCommand("indentLess"); } + + function selectLine() { + var editor = EditorManager.getFocusedEditor(); + if (editor) { + var sel = editor.getSelection(); + var from = {line: sel.start.line, ch: 0}; + var to = {line: sel.end.line + 1, ch: 0}; + editor.setSelection(from, to); + } + } // Register commands CommandManager.register(Strings.CMD_INDENT, Commands.EDIT_INDENT, indentText); @@ -304,4 +313,5 @@ define(function (require, exports, module) { CommandManager.register(Strings.CMD_DELETE_LINES, Commands.EDIT_DELETE_LINES, deleteCurrentLines); CommandManager.register(Strings.CMD_LINE_UP, Commands.EDIT_LINE_UP, moveLineUp); CommandManager.register(Strings.CMD_LINE_DOWN, Commands.EDIT_LINE_DOWN, moveLineDown); + CommandManager.register(Strings.CMD_SELECT_LINE, Commands.EDIT_SELECT_LINE, selectLine); }); diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 7cf703a7d03..d7bb109c9be 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -173,6 +173,7 @@ define({ // Edit menu commands "EDIT_MENU" : "Edit", "CMD_SELECT_ALL" : "Select All", + "CMD_SELECT_LINE" : "Select Line", "CMD_FIND" : "Find", "CMD_FIND_IN_FILES" : "Find in Files", "CMD_FIND_NEXT" : "Find Next",