diff --git a/lib/veilid_processor/views/developer.dart b/lib/veilid_processor/views/developer.dart index 0bfcc0a..e329d47 100644 --- a/lib/veilid_processor/views/developer.dart +++ b/lib/veilid_processor/views/developer.dart @@ -21,7 +21,7 @@ import '../../tools/tools.dart'; import 'history_text_editing_controller.dart'; final globalDebugTerminal = Terminal( - maxLines: 50000, + maxLines: 10000, ); const kDefaultTerminalStyle = TerminalStyle( @@ -187,6 +187,15 @@ class _DeveloperPageState extends State { } } + Future _onSubmitCommand(String debugCommand) async { + final ok = await _sendDebugCommand(debugCommand); + if (ok) { + setState(() { + _historyController.submit(debugCommand); + }); + } + } + @override Widget build(BuildContext context) { final theme = Theme.of(context); @@ -282,16 +291,17 @@ class _DeveloperPageState extends State { textStyle: kDefaultTerminalStyle, controller: _terminalController, keyboardType: TextInputType.none, - //autofocus: true, backgroundOpacity: _showEllet ? 0.75 : 1.0, onSecondaryTapDown: (details, offset) async { await copySelection(context); }) ]).expanded(), - TextField( + TextFormField( enabled: !_busy, + autofocus: true, controller: _historyController.controller, focusNode: _historyController.focusNode, + textInputAction: TextInputAction.send, onTapOutside: (event) { FocusManager.instance.primaryFocus?.unfocus(); }, @@ -323,7 +333,7 @@ class _DeveloperPageState extends State { final debugCommand = _historyController.controller.text; _historyController.controller.clear(); - await _sendDebugCommand(debugCommand); + await _onSubmitCommand(debugCommand); }, )), onChanged: (_) { @@ -334,17 +344,12 @@ class _DeveloperPageState extends State { _historyController.controller.clearComposing(); // don't give up focus though }, - onSubmitted: (debugCommand) async { + onFieldSubmitted: (debugCommand) async { if (debugCommand.isEmpty) { return; } - - final ok = await _sendDebugCommand(debugCommand); - if (ok) { - setState(() { - _historyController.submit(debugCommand); - }); - } + await _onSubmitCommand(debugCommand); + _historyController.focusNode.requestFocus(); }, ).paddingAll(4) ])));