Can send message to the monitor with Enter.

Removed the required `Ctrl/Cmd` modifier.

Closes #572

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta 2022-09-05 19:24:11 +02:00 committed by Akos Kitta
parent 35fcfb89c1
commit 5f82577bc1
2 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,6 @@
import * as React from '@theia/core/shared/react'; import * as React from '@theia/core/shared/react';
import { Key, KeyCode } from '@theia/core/lib/browser/keys'; import { Key, KeyCode } from '@theia/core/lib/browser/keys';
import { Board } from '../../../common/protocol/boards-service'; import { Board } from '../../../common/protocol/boards-service';
import { isOSX } from '@theia/core/lib/common/os';
import { DisposableCollection, nls } from '@theia/core/lib/common'; import { DisposableCollection, nls } from '@theia/core/lib/common';
import { BoardsServiceProvider } from '../../boards/boards-service-provider'; import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { MonitorModel } from '../../monitor-model'; import { MonitorModel } from '../../monitor-model';
@ -81,8 +80,7 @@ export class SerialMonitorSendInput extends React.Component<
const port = this.props.boardsServiceProvider.boardsConfig.selectedPort; const port = this.props.boardsServiceProvider.boardsConfig.selectedPort;
return nls.localize( return nls.localize(
'arduino/serial/message', 'arduino/serial/message',
"Message ({0} + Enter to send message to '{1}' on '{2}')", "Message (Enter to send message to '{0}' on '{1}')",
isOSX ? '⌘' : nls.localize('vscode/keybindingLabels/ctrlKey', 'Ctrl'),
board board
? Board.toString(board, { ? Board.toString(board, {
useFqbn: false, useFqbn: false,
@ -110,8 +108,8 @@ export class SerialMonitorSendInput extends React.Component<
protected onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void { protected onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {
const keyCode = KeyCode.createKeyCode(event.nativeEvent); const keyCode = KeyCode.createKeyCode(event.nativeEvent);
if (keyCode) { if (keyCode) {
const { key, meta, ctrl } = keyCode; const { key } = keyCode;
if (key === Key.ENTER && ((isOSX && meta) || (!isOSX && ctrl))) { if (key === Key.ENTER) {
this.onSend(); this.onSend();
} }
} }

View File

@ -336,7 +336,7 @@
"serial": { "serial": {
"autoscroll": "Autoscroll", "autoscroll": "Autoscroll",
"carriageReturn": "Carriage Return", "carriageReturn": "Carriage Return",
"message": "Message ({0} + Enter to send message to '{1}' on '{2}')", "message": "Message (Enter to send message to '{0}' on '{1}')",
"newLine": "New Line", "newLine": "New Line",
"newLineCarriageReturn": "Both NL & CR", "newLineCarriageReturn": "Both NL & CR",
"noLineEndings": "No Line Ending", "noLineEndings": "No Line Ending",