Migrate hardcoded keys to KeyBindings using TG 2.1.1-develop.59 Command enum values#120
Conversation
Define editor-specific Command constants (InsertTabCommand, UnindentCommand, FindNextCommand, FindPreviousCommand, FindCommand, ReplaceCommand) and register them via AddCommand + DefaultKeyBindings so all keys are user-configurable. Remove hardcoded key checks (Tab, Shift+Tab, F3, Shift+F3, Ctrl+F, Ctrl+H) from OnKeyDownNotHandled, which now only handles rune insertion. Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/218aede8-cecb-4b28-98fa-b6785329a127 Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
@copilot read the constitution regarding this being part of TG. We don't work around TG limits like missing command enum values. We file Issues against TG so things get fixed right. |
1 similar comment
|
@copilot read the constitution regarding this being part of TG. We don't work around TG limits like missing command enum values. We file Issues against TG so things get fixed right. |
…ound missing enum values Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/996d1878-3b57-459f-b812-610d4519bbbc Co-authored-by: tig <585482+tig@users.noreply.github.com>
Reverted in e671ac1. All custom
Addressed in e671ac1 — same revert as above, restoring original key handling and removing all custom Command casts. |
Reverted the custom
Reverted in |
|
@copilot you file the issue on tg |
I'm unable to file issues on other repositories — I can only make changes within this repo's PR. Could you or another maintainer file the issue on gui-cs/Terminal.Gui requesting the following
Once those land in TG, the keys currently in |
|
@copilot see gui-cs/Terminal.Gui#5309 - it's been merged. you might have to wait for nuget to publish. |
Checked — the latest available NuGet package ( |
|
@copilot .59 is now published. |
…nd enum values Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/98cb99e0-eef5-4227-98c6-27a5de3f822d Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/98cb99e0-eef5-4227-98c6-27a5de3f822d Co-authored-by: tig <585482+tig@users.noreply.github.com>
Bumped |
|
@copilot I don't see any new tests. Is this all thourogly tested? |
…ce, FindNext, FindPrevious) Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/692086f6-e75d-43bd-867d-931ae63bcb4b Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/692086f6-e75d-43bd-867d-931ae63bcb4b Co-authored-by: tig <585482+tig@users.noreply.github.com>
Added 20 integration tests in
Combined with the pre-existing tests in |
Tab, Shift+Tab, F3, Shift+F3, Ctrl+F, and Ctrl+H were handled via direct key comparison in
OnKeyDownNotHandledinstead of through Terminal.Gui'sKeyBindingssystem, making them non-configurable.Changes
TerminalGuiVersionfrom2.1.0to2.1.1-develop.59, which includes the newCommandenum values added in gui-cs/Terminal.Gui#5309.DefaultKeyBindings(Editor.Commands.cs):Command.InsertTab→ TabCommand.Unindent→ Shift+TabCommand.FindNext→ F3Command.FindPrevious→ Shift+F3Command.Find→ Ctrl+FCommand.Replace→ Ctrl+HAddCommandhandlers for all 6 commands with extracted helper methods.OnKeyDownNotHandledinEditor.Keyboard.cs— the direct key comparisons for Tab, Shift+Tab, F3, Shift+F3, Ctrl+F, and Ctrl+H are replaced by properKeyBindingsentries.ApplyKeyBindings, but now re-adds them bound toCommand.InsertTab/Command.Unindent.EditorKeyBindingTests.cscoveringDefaultKeyBindingsregistration,InvokeCommandbehavior (including ReadOnly guards), and key-to-command wire-up for all 6 migrated bindings.All six keys are now user-configurable through the
DefaultKeyBindingsdictionary, consistent with how every other editor key binding works.