π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(desktop): read typed keys when a field spans lines or outgrows a step
Luis Ortiz5c0e94aea0e2
diff --git a/apps/desktop/scripts/check-pipeline.ts b/apps/desktop/scripts/check-pipeline.tsindex e11af0a..e4c058b 100644--- a/apps/desktop/scripts/check-pipeline.ts+++ b/apps/desktop/scripts/check-pipeline.ts@@ -495,10 +495,13 @@ app.whenReady().then(async () => {typedTextFor(editor(null), 'typed') === 'typed' &&typedTextFor({ ...editor('\uFEFFhi\u200B'), role: 'textbox' }, '') === 'hi' &&typedTextFor(control, 'typed') === null &&- typedTextFor(editor('x'.repeat(81)), 'ab') === 'ab' &&- typedTextFor(editor('y'.repeat(100)), 'z'.repeat(60)) === 'y'.repeat(100),+ typedTextFor(editor('x'.repeat(201)), 'ab') === 'ab' &&+ typedTextFor(editor('y'.repeat(200)), 'ab') === 'y'.repeat(200) &&+ typedTextFor(editor('Last login: Thu Oct 1 12:39:09 on ttys000\nβ ~ testing, clicking above showed the full desk'), 'testing, clicking above showed the full desk') === 'testing, clicking above showed the full desk' &&+ typedTextFor(editor(`Last login\r\nβ ~ ${'w'.repeat(60)}`), 'w'.repeat(60)) === 'w'.repeat(60) &&+ typedTextFor(editor('line one\nline two'), '') === 'line one\nline two',detail:- 'a field longer than twice the buffer and 80 characters yields the buffer, a shorter one yields the field, markers are stripped, a button yields nothing',+ 'a field spanning lines or longer than a step can show yields the keystrokes, any other field yields its text, hidden characters are stripped, a button yields nothing',});const typedThenClicked = async (keysAfterSnapshot: number) => {diff --git a/apps/desktop/src/main/capture/recorder.ts b/apps/desktop/src/main/capture/recorder.tsindex ffdc190..cd8b9b8 100644--- a/apps/desktop/src/main/capture/recorder.ts+++ b/apps/desktop/src/main/capture/recorder.ts@@ -25,8 +25,8 @@ const TARGET_SIZE = 28;const SETTLE_MS = 60;const SNAPSHOT_MS = 400;const REPEAT_CLICK_MS = 500;-const MARKER_CODE_POINTS = new Set([0x200b, 0xfeff, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd]);-const FIELD_FLOOR = 80;+const HIDDEN_CHARACTERS = /[\p{Cf}\uFFFC\uFFFD]/gu;+const STEP_TEXT_LIMIT = 200;const KEY = {escape: 1,@@ -160,10 +160,10 @@ export function clickAction(button: number): string {export function typedTextFor(field: ScreenElement | null, buffer: string, readField = true): string | null {if (!field || !isTextField(field)) return null;if (!readField) return buffer || null;- const shown = [...(field.textContent ?? '')].filter((char) => !MARKER_CODE_POINTS.has(char.codePointAt(0) ?? 0));- if (!shown.join('').trim()) return buffer || null;- const typed = [...buffer].length;- return typed > 0 && shown.length > Math.max(2 * typed, FIELD_FLOOR) ? buffer : shown.join('');+ const shown = (field.textContent ?? '').replace(HIDDEN_CHARACTERS, '');+ if (!shown.trim()) return buffer || null;+ const wholeCanvas = /[\r\n]/.test(shown) || [...shown].length > STEP_TEXT_LIMIT;+ return buffer && wholeCanvas ? buffer : shown;}export function isBoundShortcut(accelerator: string | null, action: KeyAction, key: string): boolean {