Editor: built-in editing context menu#153
Conversation
- Add Editor.ContextMenu property with default PopoverMenu (Undo, Redo, Cut, Copy, Paste, Select All) - Handle right-click in Editor.Mouse.cs to show context menu - Add Command.Context command binding - State-aware: disable items based on ReadOnly, selection, undo/redo state - Opt-out: set ContextMenu to null to suppress - Update ted to use built-in context menu instead of custom wiring - Add EditorContextMenuTests with 6 integration tests Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/2b9401e3-9b8e-48ef-a1da-52daeb0e6be1 Co-authored-by: tig <585482+tig@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de26290d05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot In ted none of the context menu items appear to work. And same for the edit menu items on the ted menubar. Keyboard shortcuts are working. |
MenuItem.Command alone does not route to PopoverMenu.Target on click — the Action delegate is what fires. Added Action = () => InvokeCommand(...) to all built-in context menu items, and also to ted's Edit menu bar Cut/Copy/Paste items which were missing Action delegates. Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/39672643-45b8-4619-9cf7-d1f709c3f83d Co-authored-by: tig <585482+tig@users.noreply.github.com>
Fixed in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot read Claude.md and ensure you are following it in this pr. Read TGs command.md. Understand how bubbling works and utilize it. |
…and routing Replace manual Action delegates with declarative command binding per TG's command.md. MenuItem(this, Command.X) lets the framework resolve title, help text, and route the command to the Editor via bubbling — no explicit Action callbacks needed. - Editor.ContextMenu.cs: use field keyword, declarative MenuItem ctors - TedApp.EditCommands.cs: declarative MenuItem(Editor, Command.X), remove Undo/Redo/SelectAll wrapper methods - Tests: verify TargetView binding and command routing Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/02daf29a-7174-4e18-8f56-9b737d56146a Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…tion Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/02daf29a-7174-4e18-8f56-9b737d56146a Co-authored-by: tig <585482+tig@users.noreply.github.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Refactored in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…github.com/gui-cs/Editor into copilot/add-default-context-menu-to-editor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15fc560e71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot resolve the merge conflicts in this pull request. And address cr feedback. |
- Merge overwrite mode commands from develop into Editor.Commands.cs - CR fix: right-click returns false when ContextMenu is null (allows bubbling) - CR fix: Command.Context returns false when ContextMenu is null (allows bubbling) - CR fix: UpdateContextMenuState skips unknown menu items (preserves custom enabled states) Co-authored-by: tig <585482+tig@users.noreply.github.com>
Merge conflicts resolved and CR feedback addressed in
All 461 unit + 231 integration tests pass. |
Editorhad no built-in context menu — consumers had to wire their ownPopoverMenuand keep it in sync with ReadOnly/selection/undo state.TextViewships one by default;Editorshould too.Changes
Editor.ContextMenu.cs— new partial with:ContextMenuproperty (nullable, settable, usesfieldkeyword) — defaults to aPopoverMenuwith Undo, Redo, Cut, Copy, Paste, Select AllMenuItem(targetView, Command)constructor — the framework resolves title/help text fromGlobalResourcesand routes commands to the Editor via command bubbling (no manualActiondelegates)ReadOnly, Cut/Copy disabled without selection, Undo/Redo reflect stack. Unknown commands from custom menus are left untouched so caller-setEnabledstates are preserved.nullto suppress; assign a customPopoverMenuto replaceEditor.Mouse.cs— right-click routes toShowContextMenu(screenPosition); returnsfalsewhenContextMenuis null so the click bubbles to parent viewsEditor.Commands.cs—Command.Contextbinding added; returnsfalsewhenContextMenuis null so the command bubbles to parent/application-level handlersexamples/ted— removed manual context menu wiring; ted's Edit menu bar items now also use declarativeMenuItem(Editor, Command.X)binding, removing the manualUndo()/Redo()/SelectAll()wrapper methodsTests
9 integration tests covering: menu appears on right-click, null suppresses it, ReadOnly disables mutating items, no-selection disables Cut/Copy, Undo enabled after edit, default is non-null, declarative binding with command order verification, command routing for SelectAll and Undo. All 461 unit + 231 integration tests pass.