Skip to content

Commit 5501bd6

Browse files
committed
2 parents fc19851 + 84355d1 commit 5501bd6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/src/terminal_view.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
33
import 'package:flutter/rendering.dart';
44
import 'package:flutter/services.dart';
55
import 'package:xterm/src/core/buffer/cell_offset.dart';
6-
76
import 'package:xterm/src/core/input/keys.dart';
87
import 'package:xterm/src/terminal.dart';
98
import 'package:xterm/src/ui/controller.dart';
@@ -163,8 +162,7 @@ class TerminalViewState extends State<TerminalView> {
163162

164163
late ScrollController _scrollController;
165164

166-
RenderTerminal get renderTerminal =>
167-
_viewportKey.currentContext!.findRenderObject() as RenderTerminal;
165+
RenderTerminal get renderTerminal => _viewportKey.currentContext!.findRenderObject() as RenderTerminal;
168166

169167
@override
170168
void initState() {
@@ -265,7 +263,8 @@ class TerminalViewState extends State<TerminalView> {
265263
onComposing: _onComposing,
266264
onAction: (action) {
267265
_scrollToBottom();
268-
if (action == TextInputAction.done) {
266+
// Android sends TextInputAction.newline when the user presses the virtual keyboard's enter key.
267+
if (action == TextInputAction.done || action == TextInputAction.newline) {
269268
widget.terminal.keyInput(TerminalKey.enter);
270269
}
271270
},
@@ -301,10 +300,8 @@ class TerminalViewState extends State<TerminalView> {
301300
terminalController: _controller,
302301
onTapUp: _onTapUp,
303302
onTapDown: _onTapDown,
304-
onSecondaryTapDown:
305-
widget.onSecondaryTapDown != null ? _onSecondaryTapDown : null,
306-
onSecondaryTapUp:
307-
widget.onSecondaryTapUp != null ? _onSecondaryTapUp : null,
303+
onSecondaryTapDown: widget.onSecondaryTapDown != null ? _onSecondaryTapDown : null,
304+
onSecondaryTapUp: widget.onSecondaryTapUp != null ? _onSecondaryTapUp : null,
308305
readOnly: widget.readOnly,
309306
child: child,
310307
);
@@ -336,8 +333,7 @@ class TerminalViewState extends State<TerminalView> {
336333
}
337334

338335
Rect get globalCursorRect {
339-
return renderTerminal.localToGlobal(renderTerminal.cursorOffset) &
340-
renderTerminal.cellSize;
336+
return renderTerminal.localToGlobal(renderTerminal.cursorOffset) & renderTerminal.cellSize;
341337
}
342338

343339
void _onTapUp(TapUpDetails details) {

0 commit comments

Comments
 (0)