File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 11import 'package:flutter/services.dart' ;
2+ import 'package:flutter/widgets.dart' ;
23import 'package:xterm/frontend/input_behavior_default.dart' ;
34import 'package:xterm/input/keys.dart' ;
45import 'package:xterm/xterm.dart' ;
56
67class InputBehaviorMobile extends InputBehaviorDefault {
78 InputBehaviorMobile ();
89
9- @override
10- final acceptKeyStroke = true ;
10+ final acceptKeyStroke = false ;
11+
12+ final initEditingState = const TextEditingValue (
13+ text: ' ' ,
14+ selection: TextSelection .collapsed (offset: 1 ),
15+ );
16+
17+ TextEditingValue onTextEdit (
18+ TextEditingValue value, TerminalUiInteraction terminal) {
19+ if (value.text.length > initEditingState.text.length) {
20+ terminal.raiseOnInput (value.text.substring (1 , value.text.length - 1 ));
21+ } else if (value.text.length < initEditingState.text.length) {
22+ terminal.keyInput (TerminalKey .backspace);
23+ } else {
24+ if (value.selection.baseOffset < 1 ) {
25+ terminal.keyInput (TerminalKey .arrowLeft);
26+ } else if (value.selection.baseOffset > 1 ) {
27+ terminal.keyInput (TerminalKey .arrowRight);
28+ }
29+ }
30+
31+ return initEditingState;
32+ }
1133
12- @override
1334 void onAction (TextInputAction action, TerminalUiInteraction terminal) {
1435 print ('action $action ' );
1536 switch (action) {
You can’t perform that action at this time.
0 commit comments