eleven / ocho Public

mac: up-arrow edit actually fires — merge into the typeahead handler (#314)

Two .onKeyPress(.upArrow) on the same TextField don't both fire (only
the outermost delivers), so the edit shortcut was dead even on a
current build. Merged into one handler: navigates the typeahead when
it's open, else edits your last message when the box is empty.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell 426a09f8289ed6e7ccce595f2e0f791ab5016a60 parent 91c56a9
1 file changed, +14 −12
  • ios/LChatMac/NativeFeedView.swift +14 −12
diff --git a/ios/LChatMac/NativeFeedView.swift b/ios/LChatMac/NativeFeedView.swift
index 3df3371..55e3446 100644
--- a/ios/LChatMac/NativeFeedView.swift
+++ b/ios/LChatMac/NativeFeedView.swift
@@ -710,14 +710,6 @@ struct NativeFeedView: View {
.buttonStyle(.plain)
.padding(.bottom, 4)
TextField("Message", text: $draft, axis: .vertical)
- .onKeyPress(.upArrow) {
- guard draft.isEmpty, editingID == nil,
- let last = model.messages.last(where: { $0.mine && !$0.action }) else {
- return .ignored
- }
- startEdit(last)
- return .handled
- }
// Paste an image (or a copied file) straight onto the draft -
// it stages as an upload, like the web composer's paste.
.onPasteCommand(of: [.png, .jpeg, .tiff, .image, .fileURL]) { providers in
@@ -739,11 +731,21 @@ struct NativeFeedView: View {
// what's about to auto-send would race it.
.disabled(sendQueued)
// Typeahead keys: ↑↓ move, Tab/Return accept, Esc dismisses —
- // Return falls through to send when no menu is up.
+ // Return falls through to send when no menu is up. Up-arrow
+ // ALSO edits the last message when the box is empty (one
+ // handler — two .onKeyPress(.upArrow) on a field don't both
+ // fire, which is why the edit shortcut never worked).
.onKeyPress(.upArrow) {
- guard !taItems.isEmpty else { return .ignored }
- taIndex = (taIndex + taItems.count - 1) % taItems.count
- return .handled
+ if !taItems.isEmpty {
+ taIndex = (taIndex + taItems.count - 1) % taItems.count
+ return .handled
+ }
+ if draft.isEmpty, editingID == nil,
+ let last = model.messages.last(where: { $0.mine && !$0.action }) {
+ startEdit(last)
+ return .handled
+ }
+ return .ignored
}
.onKeyPress(.downArrow) {
guard !taItems.isEmpty else { return .ignored }