res-code: fix key forwarding + add MenuBar UI element #17
Labels
No labels
harness
proj-core-console
proj-core-demo
proj-core-edit
proj-core-init
proj-core-lib
proj-core-login
proj-core-res
proj-core-sh
proj-core-theme
proj-docs
proj-extra-calc
proj-extra-code
proj-extra-playbook
proj-extra-sheets
proj-harness
proj-os
residual
tier-0-trivial
tier-1-easy
tier-2-medium
tier-3-hard
tier-4-major
tier-5-epic
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
residual/.agent#17
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
res-code: fix key forwarding + add MenuBar UI element
Problem
After the Phase 1 refactoring of
core/lib/edit(removing the mode system and key handling), res-code's key forwarding is broken. Atextra/internal/code/keys.go:135:This forwards key messages to
edit.Editor.Update(), which now only handlesWindowSizeMsgandMouseMsg. Key messages are silently dropped — res-code cannot type, navigate, or edit text.Plan
Part 1: Fix res-code key forwarding (CRITICAL)
Replace the
e.Update(msg)forwarding inkeys.go:129-139with direct calls to the raw methods onedit.Editor.Before (broken):
After (working):
Also deduplicate
doFind()— replace withe.Find(query)from the library.Files to change:
extra/internal/code/keys.go— replacee.Update(msg)forwarding, replacedoFind()withe.Find()Part 2: Add MenuBar to
core/lib/cmd/uiNew VS Code-style menu bar with categorized dropdowns. This is a new UI element in the cmd/ui package.
Design:
API:
Keyboard navigation:
Left/Right— move between categories (when bar is focused)Enter/Down— open dropdown / move down in dropdownUp— move up in dropdownEnteron item — confirm, return item IDEsc— close dropdownAlt+F,Alt+E, etc. — open specific category (optional, for power users)Files to create:
core/lib/cmd/ui/menu.go— MenuBar implementationFiles to update:
core/lib/cmd/ui/types.go— update package doc to list MenuBarPart 3: Wire MenuBar into res-code
Add a menu bar to res-code as an alternative to the current keybind-only interface.
Menu structure for res-code:
Files to change:
extra/internal/code/model.go— add MenuBar field, focus zone, modeextra/internal/code/keys.go— handle MenuBar input when focused, dispatch menu commandsextra/internal/code/render.go— render menu bar at top of screenVerification
cd core && go build ./... && go test ./...cd extra && go build ./...:— palette opens, type:wto saveLabels
proj-core-lib,proj-extra-code,tier-3-hardComplete ✅
Part 1: Fix res-code key forwarding
e.Update(msg)(which silently dropped key messages) with direct calls toInsertRune,MoveUp,Backspace, etc.doFind()— now callse.Find()from the libraryedit,buffer,fmt)eaad4abPart 2: Add MenuBar to core/lib/cmd/ui
MenuBarwidget withMenuCategory→MenuItem(label, shortcut, ID, separator, disabled)b241434Part 3: Wire MenuBar into res-code
dispatchMenuCommand()routes menu IDs to existing IDE functions4dd1b71Build verification
core/—go build,go test,go vetall cleanextra/—go buildclean