PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Windows: Make the `Ctrl+RightArrow` key accepts the next suggestion word in addition to its default by-word movement.

Open sangafabrice opened this issue 1 year ago • 0 comments

PR Summary

  • Modify the NextWord handler to accept the next suggestion word for consistently using the Ctrl+RightArrow key
  • The Ctrl+RightArrow now moves the cursor word-by-word for both editing the line and accepting suggestions
  • Before, the NextWord handler did not operate on the suggestion text when the cursor was at the end of the line
  • NextWord is now an alternative to the less consistent custom binding ForwardCharAndAcceptNextSuggestionWord defined in the SamplePSReadlineProfile.ps1 script
  • ForwardCharAndAcceptNextSuggestionWord is less consistent because it mixes word movement, line movement, and character movement in a single key
  • NextWord is now consistent because the Ctrl+RightArrow key moves the cursor uniformly in the editing and suggestion cases
  • Documentation is not needed at PowerShell-Docs because NextWord is not in the list of the advertised functions
  • This commit is a feature addition, and it does not impact the previous use of the Ctrl+RightArrow key in Windows

PR Checklist

  • [x] PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • [x] Summarized changes
  • [ ] Make sure you've added one or more new tests
  • [x] Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • [x] Not Applicable
    • OR
    • [ ] Documentation needed at PowerShell-Docs
      • [ ] Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

sangafabrice avatar Nov 23 '24 18:11 sangafabrice