On the T-LoRa Pager there was no way to paste: the in-RAM clipboard is only consumed by the Cut/Copy/Paste edit menu, which opens solely from a touch long-press on a textarea, and the Pager's encoder never reaches LVGL's press events. Copy from a message bubble worked; nothing could paste the result -- the 64-hex contact key and 32-hex channel secret fields being the painful cases. Physical Fn(Alt) held + V now pastes into the field being edited: - PagerKeyboardState: V_POS; a held-Alt V press is resolved by matrix position before the symbol map, swallowed, and reported through alt_v_chord_pending_/consumeAltVChord() (same shape as Alt+Backspace and the Pro's Alt+B). discardAlt() clears it. !HAS_TDECK_PRO only. - PagerKeyboard.h/.cpp: pagerKeyboardConsumeAltVChord(). - UITask: the Paste cell's logic is factored into txtPasteInto(ta) (selection replaced, pasteTextFor hex-key extraction kept) and reused by updatePagerAltVChord(), which uses the same "actually editing" test as the Alt+Shift Caps chord, hides any open edit menu/accent popup, and toasts "Pasted" / "Clipboard empty". Drained at the remote-mirror and screen-off discard sites like the other chords. - TLORA_PAGER_SHORTCUTS.md: documented. - test_pager_keyboard_state: chord fires once and swallows V; tap-Fn-then-V still returns '?'; discardAlt() drops a pending chord. Trade-off: Fn+V is '?' on this layout, so only a HELD Fn chords. The one-shot (tap Fn, then V) and locked (double-tap Fn) symbol layers still type '?', the same compromise the Pro's physical Alt+B makes with '!'. Tested on tlora_pager_sx1262_companion_radio_touch: Copy from a bubble then Fn+V in the composer pastes; Fn+V in a key field pastes just the key out of a copied message; empty clipboard toasts; tap-Fn-then-V still types '?'. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VKtRiAcddFBAUDogBWmZk4
111 lines
4.6 KiB
C++
111 lines
4.6 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include <assert.h>
|
|
|
|
#include "helpers/input/PagerKeyboardState.h"
|
|
|
|
int main() {
|
|
PagerKeyboardState keyboard;
|
|
|
|
assert(keyboard.event(0, true, 10) == 'q');
|
|
keyboard.event(0, false, 20);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 100);
|
|
assert(keyboard.altHeld());
|
|
assert(keyboard.event(0, true, 110) == '1');
|
|
keyboard.event(0, false, 120);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 130);
|
|
assert(keyboard.event(0, true, 140) == 'q');
|
|
keyboard.event(0, false, 150);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 200);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 220);
|
|
assert(keyboard.event(1, true, 230) == '2');
|
|
keyboard.event(1, false, 240);
|
|
assert(keyboard.event(1, true, 250) == 'w');
|
|
keyboard.event(1, false, 260);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 300);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 320);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 400);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 420);
|
|
assert(keyboard.event(0, true, 430) == '1');
|
|
keyboard.event(0, false, 440);
|
|
assert(keyboard.event(1, true, 450) == '2');
|
|
keyboard.event(1, false, 460);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 470);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 480);
|
|
assert(keyboard.event(0, true, 490) == 'q');
|
|
keyboard.event(0, false, 500);
|
|
|
|
keyboard.event(PagerKeyboardState::SHIFT_POS, true, 510);
|
|
assert(keyboard.event(0, true, 520) == 'Q');
|
|
keyboard.event(0, false, 530);
|
|
keyboard.event(PagerKeyboardState::SHIFT_POS, false, 540);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 600);
|
|
keyboard.event(PagerKeyboardState::SHIFT_POS, true, 610);
|
|
assert(keyboard.consumeAltShiftChord());
|
|
assert(!keyboard.consumeAltShiftChord());
|
|
keyboard.toggleCaps();
|
|
keyboard.event(PagerKeyboardState::SHIFT_POS, false, 620);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 630);
|
|
assert(keyboard.event(0, true, 640) == 'Q');
|
|
keyboard.event(0, false, 650);
|
|
keyboard.toggleCaps();
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 700);
|
|
assert(keyboard.event(PagerKeyboardState::BACKSPACE_POS, true, 710) == 0);
|
|
assert(keyboard.consumeAltBackspaceChord());
|
|
assert(!keyboard.backspaceHeld());
|
|
keyboard.event(PagerKeyboardState::BACKSPACE_POS, false, 720);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 730);
|
|
assert(keyboard.event(0, true, 740) == 'q');
|
|
keyboard.event(0, false, 750);
|
|
|
|
// Physical Fn+V = paste chord: V is swallowed, the chord is reported once,
|
|
// and nothing leaks into the next plain keypress.
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 760);
|
|
assert(keyboard.event(PagerKeyboardState::V_POS, true, 770) == 0);
|
|
assert(keyboard.consumeAltVChord());
|
|
assert(!keyboard.consumeAltVChord());
|
|
keyboard.event(PagerKeyboardState::V_POS, false, 780);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 790); // used-while-held: no one-shot armed
|
|
assert(keyboard.event(0, true, 792) == 'q');
|
|
keyboard.event(0, false, 794);
|
|
// Tap Fn, then V (one-shot symbol layer) still types '?' -- not a chord.
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 795);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 796);
|
|
assert(keyboard.event(PagerKeyboardState::V_POS, true, 797) == '?');
|
|
assert(!keyboard.consumeAltVChord());
|
|
keyboard.event(PagerKeyboardState::V_POS, false, 798);
|
|
// discardAlt() drops a pending chord too.
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 799);
|
|
keyboard.event(PagerKeyboardState::V_POS, true, 799);
|
|
keyboard.discardAlt();
|
|
assert(!keyboard.consumeAltVChord());
|
|
keyboard.event(PagerKeyboardState::V_POS, false, 799);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 799);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 800);
|
|
keyboard.discardAlt();
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 810);
|
|
assert(keyboard.event(0, true, 820) == 'q');
|
|
keyboard.event(0, false, 830);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 900);
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 920);
|
|
keyboard.markAltUsed(); // no effect without a physical hold
|
|
assert(keyboard.event(PagerKeyboardState::SPACE_POS, true, 930) == ' ');
|
|
assert(keyboard.spaceHeld());
|
|
keyboard.event(PagerKeyboardState::SPACE_POS, false, 940);
|
|
assert(!keyboard.spaceHeld());
|
|
assert(keyboard.event(0, true, 950) == 'q');
|
|
keyboard.event(0, false, 960);
|
|
|
|
keyboard.event(PagerKeyboardState::ALT_POS, true, 1000);
|
|
keyboard.markAltUsed(); // physical Alt+encoder equivalent
|
|
keyboard.event(PagerKeyboardState::ALT_POS, false, 1010);
|
|
assert(keyboard.event(0, true, 1020) == 'q');
|
|
return 0;
|
|
} |