Skip to content

TextField: Missing keyboard shortcuts for Windows #77020

Closed

Description

@PavelPZ

I follow recomendation in #64721 (comment) ("If you find specific issues in a current version..." )

For windows, the following shortcuts are missing: Ctrl+End, Ctrl+Home, Ctrl+Shift+End, Ctrl+Shift+Home, Shift+End, Shift+Home

Activity

  1. TahaTesser commented on Mar 2, 2021

    @TahaTesser
    Contributor

    Hi @PavelPZ
    Please provide uses cases for these shortcuts, actual results, and expected with a code sample
    Can you please provide your flutter doctor -v and a complete reproducible minimal code sample with print examples
    Thank you

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 2, 2021
  3. PavelPZ commented on Mar 4, 2021

    @PavelPZ
    Author

    Hi @TahaTesser, I thing the problem is discussed in #76121

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 4, 2021
  5. TahaTesser commented on Mar 5, 2021

    @TahaTesser
    Contributor

    HI @PavelPZ
    Yes, that issue explains what HOME or END keys are supposed to do, Can you please explain what Ctrl+End, Ctrl+Home, Ctrl+Shift+End, Ctrl+Shift+Home, Shift+End, Shift+Home are supposed to do?

    Sample and expected results similar to #76121 (comment)
    Thank you

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 5, 2021
  7. AberrantWolf commented on Mar 6, 2021

    @AberrantWolf

    I didn't file this issue, but I'm also encountering the problem, so here's the detailed information.

    Similar sample code to #76121 (comment), but multiple lines are required.

    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Text Edit',
          home: _TextFieldExample(),
        );
      }
    }
    
    class _TextFieldExample extends StatefulWidget {
      @override
      _TextFieldExampleState createState() => _TextFieldExampleState();
    }
    
    class _TextFieldExampleState extends State<_TextFieldExample> {
      final FocusNode _focusNode = FocusNode();
      final TextEditingController _textController = TextEditingController();
    
      @override
      void dispose() {
        _focusNode.dispose();
        _textController.dispose();
        super.dispose();
      }
    
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('Text Test'),
          ),
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                SizedBox(
                  width: 400,
                  child: TextField(
                    controller: _textController,
                    focusNode: _focusNode,
                    minLines: 5,
                    maxLines: 5,
                    decoration: InputDecoration(
                      hintText:
                          'Write several lines, then experiment with\nShift+HOME, Shift+END,\nCtrl+HOME, Ctrl+END,\nand\nCtrl+Shift+HOME, Ctrl+Shift+END',
                      border: const OutlineInputBorder(),
                    ),
                  ),
                ),
              ],
            ),
          ),
        );
      }
    }

    Expected Results:

    • Shift+HOME: selects all text from the cursor/pivot to the beginning of the current line
    • Shift+END: selects all text from the cursor/pivot to the end of the current line
    • Ctrl+HOME: moves the cursor to the beginning of the text (first line, before the first character)
    • Ctrl+END: move the cursor to the end of the text (last line, after the last character)
    • Ctrl+Shift+HOME: selects all text from the cursor/pivot back to the beginning of the text (first line, through first character)
    • Ctrl+Shift+END: selects all text from the cursor/pivot forward to the end of the text (last line, through the last character)

    Actual Results:

    • Shift+HOME: nothing happens
    • Shift+END: nothing happens
    • Ctrl+HOME: nothing happens
    • Ctrl+END: nothing happens
    • Ctrl+Shift+HOME: nothing happens
    • Ctrl+Shift+END: nothing happens

    Tested On

    Platform Windows
    2.0.1 beta channel: Fail
    2.10.0-10.0.pre dev channel: Fail

    Flutter Doctor:
    [√] Flutter (Channel dev, 2.1.0-10.0.pre, on Microsoft Windows [Version 10.0.19041.804], locale en-US)
        • Flutter version 2.1.0-10.0.pre at G:\Programming\Libs\flutter
        • Framework revision cc9b78fc5c (8 days ago), 2021-02-25 13:26:03 -0800
        • Engine revision a252ec09b7
        • Dart version 2.13.0 (build 2.13.0-77.0.dev)
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at C:\AndroidSdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_SDK_ROOT = C:\AndroidSdk
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.8.30907.101
        • Windows 10 SDK version 10.0.18362.0
    
    [√] Android Studio (version 4.1.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [√] VS Code (version 1.52.1)
        • VS Code at C:\Users\lareo\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.19.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19041.804]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.190
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.74
    
    • No issues found!
    
  8. AberrantWolf commented on Mar 6, 2021

    @AberrantWolf

    Also, if someone can point me to where the inputs come in and where they're mapped and turned into actions (even if on Linux/MacOS) I'm happy to take a look at implementing this on Windows. I looked briefly at the repos and couldn't figure it out and don't have the time to spend all day just learning the code structure, sadly. But point me at some source files and I'm happy to try to fix it myself.

  9. canastro commented on Mar 7, 2021

    @canastro
    Contributor

    @AberrantWolf the text editing shortcuts is currently being redesigned;

    In that PR you can check the packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart to see that some of those shortcuts are already being considered.

  10. removed
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 9, 2021
  11. TahaTesser commented on Mar 9, 2021

    @TahaTesser
    Contributor

    @AberrantWolf
    Thank you so much for the details! #77020 (comment)

  12. added
    P2Important issues not at the top of the work list
    on Mar 11, 2021
  13. gspencergoog commented on Mar 11, 2021

    @gspencergoog
    Contributor
  14. justinmc commented on Apr 2, 2021

    @justinmc
    Contributor

    Thanks @PavelPZ and @AberrantWolf for reporting this and for all of the info.

    Shift + home and shift + end should work now, but let me know if they're still not working. For the others, I'll plan to open a PR to support them soon.

    You can see all of the text editing keyboard shortcuts for Windows here:

    static final Map<LogicalKeySet, Intent> _windowsShortcuts = <LogicalKeySet, Intent>{
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.end): const MoveSelectionRightByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.home): const MoveSelectionLeftByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.end): const ExpandSelectionRightByLineTextIntent(),
    LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.home): const ExpandSelectionLeftByLineTextIntent(),

  15. NikolaTotev commented on Apr 4, 2021

    @NikolaTotev

    Hello, shift+home and shift+end still don't work for me. I can't find the file shown above in my flutter directory, what is the correct/ recommended procedure for adding this file into my flutter folder?

  16. AberrantWolf commented on Apr 5, 2021

    @AberrantWolf

    Hello, shift+home and shift+end still don't work for me. I can't find the file shown above in my flutter directory, what is the correct/ recommended procedure for adding this file into my flutter folder?

    I think I saw that the CL got reverted because it ended up breaking some test once it got committed but which wasn't caught pre-submission for some reason.

    But for it to be there at all, you'd also need to make sure you're on the latest channel for Flutter, not Stable or Beta or whatever (just in case). So that's something to check. I might be able to check later, but the project where I was using it has been pushed back, so I haven't updated in a while.

  17. justinmc commented on Sep 25, 2021

    @justinmc
    Contributor

    I just tried this out on master on my Windows machine and this is what I'm seeing:

    Shortcut Behavior (Windows) Behavior (Flutter)
    Ctrl+Home/End move to start/end of all text ❌ nothing
    Ctrl+Shift+Home/End extend selection to start/end of all text ❌ nothing
    Shift+Home/End extend selection to start/end of line ❌ works, but pauses at inversion, and jumps lines

    Will open a PR for this.

  18. added
    r: fixedIssue is closed as already fixed in a newer version
    on Nov 24, 2021
  19. github-actions commented on Dec 8, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopc: new featureNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions