Przeglądaj źródła

Make actions findable

xuty 3 lat temu
rodzic
commit
9c34389fcf
2 zmienionych plików z 15 dodań i 13 usunięć
  1. 2 2
      lib/src/terminal_view.dart
  2. 13 11
      lib/src/ui/shortcut/actions.dart

+ 2 - 2
lib/src/terminal_view.dart

@@ -300,8 +300,8 @@ class TerminalViewState extends State<TerminalView> {
       event,
     );
 
-    if (shortcutResult == KeyEventResult.handled) {
-      return KeyEventResult.handled;
+    if (shortcutResult != KeyEventResult.ignored) {
+      return shortcutResult;
     }
 
     if (event is! RawKeyDownEvent) {

+ 13 - 11
lib/src/ui/shortcut/actions.dart

@@ -25,7 +25,7 @@ class TerminalActions extends StatelessWidget {
 
     return Actions(
       actions: {
-        PasteTextIntent: CallbackAction(
+        PasteTextIntent: CallbackAction<PasteTextIntent>(
           onInvoke: (intent) async {
             final data = await Clipboard.getData(Clipboard.kTextPlain);
             final text = data?.text;
@@ -36,7 +36,7 @@ class TerminalActions extends StatelessWidget {
             return null;
           },
         ),
-        CopySelectionTextIntent: CallbackAction(
+        CopySelectionTextIntent: CallbackAction<CopySelectionTextIntent>(
           onInvoke: (intent) async {
             final selection = controller.selection;
 
@@ -51,15 +51,17 @@ class TerminalActions extends StatelessWidget {
             return null;
           },
         ),
-        SelectAllTextIntent: CallbackAction(onInvoke: (intent) {
-          controller.setSelection(
-            BufferRange(
-              CellOffset(0, terminal.buffer.height - terminal.viewHeight),
-              CellOffset(terminal.viewWidth, terminal.buffer.height - 1),
-            ),
-          );
-          return null;
-        }),
+        SelectAllTextIntent: CallbackAction<SelectAllTextIntent>(
+          onInvoke: (intent) {
+            controller.setSelection(
+              BufferRange(
+                CellOffset(0, terminal.buffer.height - terminal.viewHeight),
+                CellOffset(terminal.viewWidth, terminal.buffer.height - 1),
+              ),
+            );
+            return null;
+          },
+        ),
       },
       child: child,
     );