From 59156a6e87c1952f904e0a000bed82d7269b226e Mon Sep 17 00:00:00 2001 From: AndreeTorres <00015722@uca.edu.sv> Date: Mon, 27 Jul 2026 09:08:46 -0600 Subject: [PATCH] =?UTF-8?q?fix:=20=E2=8C=98C,=20=E2=8C=98V,=20=E2=8C=98X,?= =?UTF-8?q?=20=E2=8C=98A=20y=20=E2=8C=98Z=20en=20los=20campos=20del=20pane?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AppKit despacha los atajos de edición por los ítems del menú Editar de la app. Corner es accesoria (LSUIElement) y no tenía menú principal, así que esas teclas nunca llegaban a los campos de texto: no se podía copiar, pegar ni seleccionar todo al escribir una tarea. Se instala un menú Editar (Deshacer, Rehacer, Cortar, Copiar, Pegar, Seleccionar todo) que nunca se muestra y solo sirve para enrutar los key equivalents. De paso ⌘Z ahora también deshace dentro de los campos. SPEC §2 actualizado; claves nuevas traducidas al inglés. --- Corner/App/AppDelegate.swift | 28 ++++++++++++ Corner/Resources/Localizable.xcstrings | 60 ++++++++++++++++++++++++++ docs/SPEC.md | 8 ++++ 3 files changed, 96 insertions(+) diff --git a/Corner/App/AppDelegate.swift b/Corner/App/AppDelegate.swift index 1447194..80af583 100644 --- a/Corner/App/AppDelegate.swift +++ b/Corner/App/AppDelegate.swift @@ -125,6 +125,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { } AppAccess.shared = self + installEditMenu() menuBar.install() hotCorner.start() @@ -141,6 +142,33 @@ final class AppDelegate: NSObject, NSApplicationDelegate { } } + /// Standard editing shortcuts (⌘C/⌘V/⌘X/⌘A/⌘Z) are dispatched by AppKit + /// through the main menu's Edit items. An accessory app (LSUIElement) has + /// no main menu, so without this they never reach the panel's text fields. + /// The menu is never displayed — it exists only to route key equivalents. + private func installEditMenu() { + let edit = NSMenu(title: "Edit") + edit.addItem(withTitle: String(localized: "Deshacer"), + action: Selector(("undo:")), keyEquivalent: "z") + edit.addItem(withTitle: String(localized: "Rehacer"), + action: Selector(("redo:")), keyEquivalent: "Z") + edit.addItem(.separator()) + edit.addItem(withTitle: String(localized: "Cortar"), + action: #selector(NSText.cut(_:)), keyEquivalent: "x") + edit.addItem(withTitle: String(localized: "Copiar"), + action: #selector(NSText.copy(_:)), keyEquivalent: "c") + edit.addItem(withTitle: String(localized: "Pegar"), + action: #selector(NSText.paste(_:)), keyEquivalent: "v") + edit.addItem(withTitle: String(localized: "Seleccionar todo"), + action: #selector(NSText.selectAll(_:)), keyEquivalent: "a") + + let editItem = NSMenuItem() + editItem.submenu = edit + let mainMenu = NSMenu() + mainMenu.addItem(editItem) + NSApp.mainMenu = mainMenu + } + private var cursorScreen: NSScreen? { NSScreen.screens.first(where: { NSMouseInRect(NSEvent.mouseLocation, $0.frame, false) diff --git a/Corner/Resources/Localizable.xcstrings b/Corner/Resources/Localizable.xcstrings index 78be826..4a891e9 100644 --- a/Corner/Resources/Localizable.xcstrings +++ b/Corner/Resources/Localizable.xcstrings @@ -240,6 +240,16 @@ } } }, + "Copiar": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Copy" + } + } + } + }, "Corner no pudo guardar en disco": { "extractionState": "manual", "localizations": { @@ -273,6 +283,16 @@ } } }, + "Cortar": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Cut" + } + } + } + }, "Crear": { "extractionState": "manual", "localizations": { @@ -306,6 +326,16 @@ } } }, + "Deshacer": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Undo" + } + } + } + }, "Editar…": { "extractionState": "manual", "localizations": { @@ -534,6 +564,16 @@ } } }, + "Pegar": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Paste" + } + } + } + }, "Permiso de Recordatorios denegado": { "localizations": { "en": { @@ -584,6 +624,16 @@ } } }, + "Rehacer": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Redo" + } + } + } + }, "Revisa tu conexión a internet e intenta de nuevo.": { "extractionState": "manual", "localizations": { @@ -606,6 +656,16 @@ } } }, + "Seleccionar todo": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Select All" + } + } + } + }, "Semana": { "extractionState": "manual", "localizations": { diff --git a/docs/SPEC.md b/docs/SPEC.md index 9fbc492..7bb9660 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -31,6 +31,14 @@ Tener las tareas del día y de la semana a un gesto de distancia — mover el mo inferior izquierda · ⌥Espacio", con botón ✕. Persiste entre aperturas hasta que se descarta; descartada, no vuelve jamás (UserDefaults). +### Atajos de edición estándar (v2.2.1, 2026-07-25) + +- En los campos del panel y de la captura rápida funcionan **⌘C, ⌘V, ⌘X, ⌘A y + ⌘Z**. AppKit reparte esos atajos por los ítems del menú Editar de la app, y + Corner —al ser accesoria (`LSUIElement`)— no tenía menú principal: por eso + las teclas no llegaban a los campos. Se instala un menú Editar que **nunca se + muestra**; existe solo para enrutar las teclas. + ### Cierre El panel se cierra cuando ocurre cualquiera de: - Clic fuera del panel (en otra app o el escritorio). Interactuar con UI colgada del panel — popovers del editor de categorías, menús contextuales — cuenta como "dentro" y nunca lo cierra.