Fixes #4825. Unify TextField and TextView Undo/Redo/Paste/DeleteAll key bindings#4828
Conversation
|
Will there be no key binding for the DeleteAll method in Non-Windows? Will it only be accessible through the context menu or by calling the DeleteAll method directly? |
Co-authored-by: tig <585482+tig@users.noreply.github.com>
I think you mis-read the above. The table shows that |
Sorry, I missed the "All Platforms" detail. |
There was a problem hiding this comment.
Pull request overview
Updates Terminal.Gui’s text editing widgets to use more standard, consistent keyboard shortcuts for Undo/Redo/Paste/DeleteAll across platforms, and aligns test coverage with the new bindings.
Changes:
- Remaps TextView commands: Ctrl+V → Paste, Ctrl+Y → Redo; removes Ctrl+V → PageDown and Ctrl+G → DeleteAll.
- Updates TextField commands: removes Ctrl+R → DeleteAll; adds non-Windows Ctrl+/ → Undo and Ctrl+Shift+Z → Redo.
- Updates/extends unit tests to reflect the new key bindings (including new “UnifiedKeyBindings” tests).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/UnitTestsParallelizable/Views/TextViewTests.cs | Updates redo key expectations and adds new keybinding verification tests. |
| Tests/UnitTestsParallelizable/Views/TextView.InputTests.cs | Updates redo key usage in input-focused tests. |
| Tests/UnitTestsParallelizable/Views/TextView.ClipboardTests.cs | Updates paste key usage in clipboard tests. |
| Tests/UnitTestsParallelizable/Views/TextFieldTests.cs | Adds new keybinding verification tests for TextField. |
| Tests/UnitTests/Views/TextViewTests.History.cs | Updates paste/redo key usage in history tests. |
| Tests/UnitTests/Views/TextViewTests.cs | Updates undo/redo and paste expectations to new bindings. |
| Terminal.Gui/Views/TextInput/TextView/TextView.Commands.cs | Implements new TextView keybinding map (including non-Windows Undo/Redo alternates). |
| Terminal.Gui/Views/TextInput/TextField/TextField.Commands.cs | Removes legacy DeleteAll binding and adds non-Windows Undo/Redo alternates. |
You can also share your feedback on Copilot code review. Take the survey.
…ssertion - Rename CtrlY→CtrlV in clipboard test names/comments (paste is now Ctrl+V) - Rename CtrlR→CtrlY in redo test name/comment (redo is now Ctrl+Y) - Replace var with explicit types (TextField/TextView) per repo style - Add Assert.DoesNotContain(Command.PageDown) to CtrlV paste test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new TextViewCommandTests class covering all public command methods (DeleteAll, SelectAll, DeleteCharLeft, DeleteCharRight, Copy, Cut, Paste, Undo, Redo) including keyboard bindings, edge cases, and event checks. Refactors DeleteAll to use SelectAll for simpler selection logic. Tests ensure correct behavior for selections, multi-line text, read-only mode, undo/redo, and event raising.
Replaces the DeleteAll command shortcut from Ctrl+Shift+D to Ctrl+Shift+Delete in both TextField and TextView. Updates all related documentation and unit tests to reflect the new key binding. Improves XML docs with detailed key binding tables and clarifies shortcut descriptions. In TextView, Ctrl+Shift+Delete now triggers DeleteAll instead of CutToEndOfLine. Ensures consistency across code, docs, and tests.
|
@BDisp There's a problem: By default Shift-ctrl-d in WT is "duplicate terminal". I've changed the default to shift-ctrl-del. |
Good choice. It's not a problem at all. |
Added detailed XML documentation to many Terminal.Gui view classes describing their default key and mouse bindings in a consistent, tabular format. This improves discoverability and usability for developers. Also made minor summary corrections, standardized table headers, and skipped a problematic test in TextViewTests.cs.
…//github.com/gui-cs/Terminal.Gui into copilot/unify-textfield-textview-keybindings

TextField and TextView had incompatible key bindings for Undo/Redo/Paste/DeleteAll, causing confusion when switching between controls. This PR unifies them to follow platform conventions.
Unified Bindings
Changes
TextField.Commands.csCtrl+R → DeleteAll(conflicted with Redo convention)Ctrl+/ → UndoandCtrl+Shift+Z → Redoon non-Windows platformsTextView.Commands.csCtrl+Y: Paste → Redo (Windows standard)Ctrl+V: PageDown (Emacs) → Paste (universal standard)Ctrl+R → RedoandCtrl+G → DeleteAllCtrl+/ → UndoandCtrl+Shift+Z → Redoon non-Windows platformsBreaking Changes
Ctrl+Yfor Paste must switch toCtrl+VCtrl+Rfor Redo must switch toCtrl+YTests
Key.R.WithCtrlfor Redo →Key.Y.WithCtrl;Key.Y.WithCtrlfor Paste →Key.V.WithCtrl)TextFieldTestsandTextViewTestsPull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.