Skip to content

Commit b3a8b95

Browse files
committed
feat: add select all option in terminal context menu
1 parent 2a693d5 commit b3a8b95

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • src/extensionsIntegrated/Terminal

src/extensionsIntegrated/Terminal/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ define(function (require, exports, module) {
5757
const CMD_NEW_TERMINAL = "terminal.new";
5858
const CMD_TERMINAL_COPY = "terminal.copy";
5959
const CMD_TERMINAL_PASTE = "terminal.paste";
60+
const CMD_TERMINAL_SELECT_ALL = "terminal.selectAll";
6061
const CMD_TERMINAL_CLEAR = "terminal.clear";
6162
const TERMINAL_CONTEXT_MENU_ID = "terminal-context-menu";
6263
const PANEL_ID = "terminal-panel";
@@ -857,6 +858,13 @@ define(function (require, exports, module) {
857858
});
858859
}
859860
});
861+
CommandManager.register(Strings.CMD_SELECT_ALL, CMD_TERMINAL_SELECT_ALL, function () {
862+
const active = _getActiveTerminal();
863+
if (active) {
864+
active.terminal.selectAll();
865+
active.focus();
866+
}
867+
});
860868
CommandManager.register(Strings.TERMINAL_CLEAR, CMD_TERMINAL_CLEAR, function () {
861869
_clearActiveTerminal();
862870
const active = _getActiveTerminal();
@@ -869,6 +877,7 @@ define(function (require, exports, module) {
869877
const terminalContextMenu = Menus.registerContextMenu(TERMINAL_CONTEXT_MENU_ID);
870878
terminalContextMenu.addMenuItem(CMD_TERMINAL_COPY);
871879
terminalContextMenu.addMenuItem(CMD_TERMINAL_PASTE);
880+
terminalContextMenu.addMenuItem(CMD_TERMINAL_SELECT_ALL);
872881
terminalContextMenu.addMenuDivider();
873882
terminalContextMenu.addMenuItem(CMD_TERMINAL_CLEAR);
874883

@@ -878,6 +887,7 @@ define(function (require, exports, module) {
878887
const hasSelection = active && active.terminal.hasSelection();
879888
CommandManager.get(CMD_TERMINAL_COPY).setEnabled(hasSelection);
880889
CommandManager.get(CMD_TERMINAL_PASTE).setEnabled(active && active.isAlive);
890+
CommandManager.get(CMD_TERMINAL_SELECT_ALL).setEnabled(!!active);
881891
CommandManager.get(CMD_TERMINAL_CLEAR).setEnabled(!!active);
882892
});
883893

0 commit comments

Comments
 (0)